On 03/30/2012 05:24 AM, Ronald S. Bultje wrote:
Hi,

On Thu, Mar 29, 2012 at 8:23 PM, Ronald S. Bultje<[email protected]>  wrote:
On Thu, Mar 29, 2012 at 12:00 PM, Ronald S. Bultje<[email protected]>  wrote:
Prevents subsequent overreads when these numbers are used as indices
in arrays.
[..]
-static int qdm2_get_vlc (GetBitContext *gb, VLC *vlc, int flag, int depth)
+static int qdm2_get_vlc (GetBitContext *gb, VLC *vlc, int flag, int depth, int 
range)
  {
     int value;

     value = get_vlc2(gb, vlc->table, vlc->bits, depth);

     /* stage-2, 3 bits exponent escape sequence */
-    if (value-- == 0)
+    if (value-- == 0) {
         value = get_bits (gb, get_bits (gb, 3) + 1);
+        if (range)
+            value = av_clip(value, 0, range - 1);
+    }
I would actually like comments from Benjamin (and others) on this.
See, the issue is that we clip the value to be back in the valid
range, but still, it means we lost "sync" on the bitstream regardless,
and thus won't be able to produce anything but noise from now on.
Should we instead just abort decoding this frame and resume on the
next one?

If out of range, just abort.

MvH
Benjamin Larsson
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to