Hi, On Fri, Mar 30, 2012 at 7:46 AM, Luca Barbato <[email protected]> wrote: > On 3/30/12 5:25 AM, Benjamin Larsson wrote: >> On 03/30/2012 05:24 AM, Ronald S. Bultje wrote: >>> 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. > > > As in clearly return an error or just abort() (so silently fail on > non-debug) because that's an impossible condition?
No, it's a very real condition, so he didn't mean abort(), he just means abort (stop) decoding, i.e. return a nice error code. Ronald _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
