[Ffmpeg-devel] Possible problem with recent changes in extradata handling

Luca Abeni lucabe72
Wed Jun 29 09:58:59 CEST 2005

Hi all,

this morning, after a cvs update I had a crash when trying to decode an
MPEG TS coming from satellite (it was euronews from hotbird).

The problem seems to be around line 1900 in libavformat/utils.c:
if(st->parser && st->parser->parser->split && !st->codec.extradata){
    int i= st->parser->parser->split(&st->codec, pkt->data, pkt->size);
        st->codec.extradata_size= i;
        st->codec.extradata= av_malloc(st->codec.extradata_size);
        memcpy(st->codec.extradata, pkt->data, st->codec.extradata_size);
(this code has been recently added, if I am not mistaken).

Now, when parsing the video stream (mpeg2 video),
st->parser->parser->split() returns -1, so an av_malloc(-1) is performed
and the following memcpy() causes the crash. I worked around the probelm
by changing "if(i)" in "if(i > 0)".

Unfortunately, I am in hurry and I have no time to get a dump of the TS
right now, but I hope to be able to submit a proper bug report
(including a .ts that can trigger the problem) after luch.

Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !

More information about the ffmpeg-devel mailing list