Commit b60ae45f authored by Yaowu Xu's avatar Yaowu Xu Committed by Gerrit Code Review
Browse files

Merge "Prevent decoder from using uninitialized entropy context."

parents b47f9c58 6c6a9781
...@@ -453,6 +453,7 @@ void vp9_setup_past_independence(VP9_COMMON *cm) { ...@@ -453,6 +453,7 @@ void vp9_setup_past_independence(VP9_COMMON *cm) {
vp9_default_coef_probs(cm); vp9_default_coef_probs(cm);
vp9_init_mode_probs(cm->fc); vp9_init_mode_probs(cm->fc);
vp9_init_mv_probs(cm); vp9_init_mv_probs(cm);
cm->fc->initialized = 1;
if (cm->frame_type == KEY_FRAME || if (cm->frame_type == KEY_FRAME ||
cm->error_resilient_mode || cm->reset_frame_context == 3) { cm->error_resilient_mode || cm->reset_frame_context == 3) {
......
...@@ -50,6 +50,7 @@ typedef struct frame_contexts { ...@@ -50,6 +50,7 @@ typedef struct frame_contexts {
struct tx_probs tx_probs; struct tx_probs tx_probs;
vp9_prob skip_probs[SKIP_CONTEXTS]; vp9_prob skip_probs[SKIP_CONTEXTS];
nmv_context nmvc; nmv_context nmvc;
int initialized;
} FRAME_CONTEXT; } FRAME_CONTEXT;
typedef struct { typedef struct {
......
...@@ -1556,6 +1556,10 @@ void vp9_decode_frame(VP9Decoder *pbi, ...@@ -1556,6 +1556,10 @@ void vp9_decode_frame(VP9Decoder *pbi,
vp9_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y); vp9_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y);
*cm->fc = cm->frame_contexts[cm->frame_context_idx]; *cm->fc = cm->frame_contexts[cm->frame_context_idx];
if (!cm->fc->initialized)
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
"Uninitialized entropy context.");
vp9_zero(cm->counts); vp9_zero(cm->counts);
xd->corrupted = 0; xd->corrupted = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment