[FFmpeg-devel] Bug in av_fifo_size?

Bill Dolson bd
Mon Nov 8 00:47:17 CET 2010


Duh.  Sorry, now I see it.  Very nice.

Bill

On 11/7/2010 3:55 PM, Bill Dolson wrote:
> Hi,
>
> I am about to submit some patches to read geospatial positioning data
> user private streams in Mpeg-2 TSes but I had a bug fix first.
>
> In the older fifo implementation I believe there was a bug in av_fifo_size.
>
> int av_fifo_size(AVFifoBuffer *f)
> {
> int size = f->wptr - f->rptr;
> if (size < 0)
> - size += f->end - f->buffer;
> + size += f->end - f->buffer + 1;
> return size;
> }
>
> The current fifo implementation has read and write indexes which are
> used for the size calculation. But what happens when they wrap around?
>
> int av_fifo_size(AVFifoBuffer *f)
> {
> return (uint32_t)(f->wndx - f->rndx);
> }
>
> Am I missing something?
>
> If not I'll submit a patch. Seems like the (corrected) original code is
> more safe no?
>
> Thanks,
> Bill Dolson
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>



More information about the ffmpeg-devel mailing list