flvdec: Fix invalid pointer deferences when parsing index
authorLaurent Aimar <fenrir@videolan.org>
Sat, 24 Sep 2011 14:16:38 +0000 (16:16 +0200)
committerMartin Storsjö <martin@martin.st>
Sat, 24 Sep 2011 15:08:39 +0000 (18:08 +0300)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/flvdec.c

index 569d734..474c4d8 100644 (file)
@@ -196,8 +196,8 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
         }
     }
 
-    if (timeslen == fileposlen)
-         for(i = 0; i < arraylen; i++)
+    if (!ret && timeslen == fileposlen)
+         for (i = 0; i < fileposlen; i++)
              av_add_index_entry(vstream, filepositions[i], times[i]*1000, 0, 0, AVINDEX_KEYFRAME);
     else
         av_log(s, AV_LOG_WARNING, "Invalid keyframes object, skipping.\n");