Add range checking for decoded coefficients.
authorYaowu Xu <yaowu@google.com>
Tue, 7 Oct 2014 18:22:09 +0000 (11:22 -0700)
committerYaowu Xu <yaowu@google.com>
Tue, 7 Oct 2014 18:30:13 +0000 (11:30 -0700)
The coefficient range checking is enabled when configured with
--enable-debug --enable-coefficient-range-checking
for vpxdec to detect ill-formed input stream. This addresses the
problem raised by issue #792.

Change-Id: I3f9ea541de4dc742dd64389d6c5f543fb1c4f052

vp9/decoder/vp9_detokenize.c

index 5778748..421229a 100644 (file)
@@ -190,7 +190,11 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, PLANE_TYPE type,
       }
     }
     v = (val * dqv) >> dq_shift;
+#if CONFIG_COEFFICIENT_RANGE_CHECKING
+    dqcoeff[scan[c]] = check_range(vp9_read_bit(r) ? -v : v);
+#else
     dqcoeff[scan[c]] = vp9_read_bit(r) ? -v : v;
+#endif
     token_cache[scan[c]] = vp9_pt_energy_class[token];
     ++c;
     ctx = get_coef_context(nb, token_cache, c);