add one missing check for stream existence in read_elst, fix #1364
authorReinhard Tartler <siretart@tauware.de>
Tue, 9 Feb 2010 18:41:17 +0000 (18:41 +0000)
committerReinhard Tartler <siretart@tauware.de>
Tue, 9 Feb 2010 18:41:17 +0000 (18:41 +0000)
backported patch r19792 by bcoudurier

Originally committed as revision 21709 to svn://svn.ffmpeg.org/ffmpeg/branches/0.5

libavformat/mov.c

index b34326c..1beba9e 100644 (file)
@@ -1776,9 +1776,13 @@ free_and_return:
 /* edit list atom */
 static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
-    MOVStreamContext *sc = c->fc->streams[c->fc->nb_streams-1]->priv_data;
+    MOVStreamContext *sc;
     int i, edit_count;
 
+    if (c->fc->nb_streams < 1)
+        return 0;
+    sc = c->fc->streams[c->fc->nb_streams-1]->priv_data;
+
     get_byte(pb); /* version */
     get_be24(pb); /* flags */
     edit_count = get_be32(pb); /* entries */