[FFmpeg-devel] [PATCH 1/3] avcodec/get_bits: add cached bitstream reader

foo86 foobaz86 at gmail.com
Sat Jul 8 21:45:25 EEST 2017


On Sat, Jul 08, 2017 at 07:25:52PM +0200, Paul B Mahol wrote:
> On 7/8/17, foo86 <foobaz86 at gmail.com> wrote:
> > On Sat, Jul 08, 2017 at 11:12:06AM +0200, Paul B Mahol wrote:
> >> [...]
> >
> >>  static inline void skip_bits(GetBitContext *s, int n)
> >>  {
> >> +#ifdef CACHED_BITSTREAM_READER
> >> +    if (n <= s->bits_left)
> >> +        skip_remaining(s, n);
> >> +    else {
> >> +        n -= s->bits_left;
> >> +        skip_remaining(s, s->bits_left);
> > This causes undefined behavior if s->bits_left == 64.
> 
> Could you elaborate?, it looks to me Libav have same issue.

Calling skip_bits_long() with n > 64 after init_get_bits() causes this
error:

libavcodec/get_bits.h:309:14: runtime error: shift exponent 64 is too
large for 64-bit type 'long unsigned int'


More information about the ffmpeg-devel mailing list