[Ffmpeg-devel] ogg2.c: bug in bufferallocation code

Jocky Wilson jocky_wilson
Tue Jun 20 16:45:08 CEST 2006


I'm developing a vlc media viewer app for the PSP and noticed a bug in 
libavformat/ogg2.c while playing live videostreams. The error occurs in 
function ogg_read_page(), the problem is that the allocated buffer size is 
doubled each time until memory runs out in my PSP and the decoding crashes.
Buffer size starts with 130kB and doubles each few minutes. The problem can 
be reconstructed on PC. I'm streaming DIV3+mp3 in ogg container code from 
vlc to PSP. Except for the bug the ogg container works best.

Would be great if Mans can fix it. Thx!

Cheers,
JockyW

ogg2.c (lines 290-296):
    if (os->bufsize - os->bufpos < size){
        uint8_t *nb = av_malloc (os->bufsize *= 2);  // JW: buffersize is 
doubled each view minutes !!
        memset (nb, 0, os->bufsize);
        memcpy (nb, os->buf, os->bufpos);
        av_free (os->buf);
        os->buf = nb;
    }






More information about the ffmpeg-devel mailing list