[FFmpeg-cvslog] r16166 - trunk/libavformat/mov.c

bcoudurier subversion
Tue Dec 16 09:47:28 CET 2008


Author: bcoudurier
Date: Tue Dec 16 09:47:28 2008
New Revision: 16166

Log:
check that nb_streams is valid before setting stream, fix crash with jp2 which do not use same structure

Modified:
   trunk/libavformat/mov.c

Modified: trunk/libavformat/mov.c
==============================================================================
--- trunk/libavformat/mov.c	(original)
+++ trunk/libavformat/mov.c	Tue Dec 16 09:47:28 2008
@@ -599,9 +599,14 @@ static int mov_read_enda(MOVContext *c, 
 /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */
 static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
-    AVStream *st = c->fc->streams[c->fc->nb_streams-1];
-    uint64_t size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;
+    AVStream *st;
+    uint64_t size;
     uint8_t *buf;
+
+    if (c->fc->nb_streams < 1) // will happen with jp2 files
+        return 0;
+    st= c->fc->streams[c->fc->nb_streams-1];
+    size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;
     if(size > INT_MAX || (uint64_t)atom.size > INT_MAX)
         return -1;
     buf= av_realloc(st->codec->extradata, size);




More information about the ffmpeg-cvslog mailing list