100l, av_read_packet must check for read_packet error, in case of
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 23 Dec 2007 13:16:55 +0000 (13:16 +0000)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 23 Dec 2007 13:16:55 +0000 (13:16 +0000)
error pkt->stream_index could be invalid and must not be used.
Fixes a crash with http://www.cs.berkeley.edu/~dmolnar/2-snippet3.wav

Originally committed as revision 11307 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/utils.c

index 59dc8db..dabe025 100644 (file)
@@ -497,6 +497,8 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
     AVStream *st;
     av_init_packet(pkt);
     ret= s->iformat->read_packet(s, pkt);
+    if (ret < 0)
+        return ret;
     st= s->streams[pkt->stream_index];
 
     switch(st->codec->codec_type){