[FFmpeg-cvslog] r18005 - trunk/libavformat/rmdec.c

Måns Rullgård mans
Mon Mar 16 21:22:51 CET 2009


"Ronald S. Bultje" <rsbultje at gmail.com> writes:

> Hi,
>
> 2009/3/16 M?ns Rullg?rd <mans at mansr.com>:
>> Vitor Sessak <vitor1001 at gmail.com> writes:
>>> Program received signal SIGSEGV, Segmentation fault.
>>> 0x080c68ff in rm_read_packet (s=0x8916ac0, pkt=0xbf8a1ab0)
>>> ? ? ?at libavformat/rmdec.c:777
>>> 777 ? ? ? ? ? ? ? ? ? st = s->streams[i];
> [..]
>> @@ -774,7 +774,8 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
>> ? ? ? ? ? ? ? ? flags = (seq++ == 1) ? 2 : 0;
>> ? ? ? ? ? ? } else {
>> ? ? ? ? ? ? ? ? len=sync(s, &timestamp, &flags, &i, &pos);
>> - ? ? ? ? ? ? ? ?st = s->streams[i];
>> + ? ? ? ? ? ? ? ?if (len > 0)
>> + ? ? ? ? ? ? ? ? ? ?st = s->streams[i];
>> ? ? ? ? ? ? }
>>
>> ? ? ? ? ? ? if(len<0 || url_feof(s->pb))
>
> Thanks for your help. Why does this crash? st is unused until after I
> check len for validity, before that it's just a memory address, no? I
> mean, I sort of thought this was valid C...

s->streams[i] with uninitialised i is a bad idea...

> Anyway, you can apply the patch anyway, sorry for breaking stuff.

Done.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-cvslog mailing list