Hi,

2011/12/15 Måns Rullgård <[email protected]>

> "Ronald S. Bultje" <[email protected]> writes:
>
> >> @@ -230,7 +263,12 @@ static inline int get_bits_count(const
> GetBitContext
> >> *s) {
> >> >  static inline void skip_bits_long(GetBitContext *s, int n){
> >> >      OPEN_READER(re, s);
> >> >      re_bit_count += n;
> >> > +#if UNCHECKED_BITSTREAM_READER
> >> >      re_buffer_ptr += re_bit_count>>5;
> >> > +#else
> >> > +    re_buffer_ptr = FFMIN(re_buffer_ptr + (re_bit_count >> 5),
> >> > +                          (const uint32_t *) s->buffer_end);
> >> > +#endif
> >>
> >> This addition can overflow.
> >>
> >
> > Changed locally to:
> >
> >     re_buffer_ptr = (re_bit_count >> 5) < (const uint32_t *)
> s->buffer_end
> > - re_buffer_ptr ?
> >                     re_buffer_ptr + (re_bit_count >> 5) : (const uint32_t
> > *) s->buffer_end;
>
> Since nothing else uses buffer_end, why not change its type and avoid
> all the casting?
>

It's accessed directly in some of the old mpegvideo-alike codecs.

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

Reply via email to