movdec: Avoid av_malloc(0) in stss
authorAlex Converse <alex.converse@gmail.com>
Fri, 3 Feb 2012 18:43:21 +0000 (10:43 -0800)
committerAlex Converse <alex.converse@gmail.com>
Fri, 3 Feb 2012 18:44:04 +0000 (10:44 -0800)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
libavformat/mov.c

index d0e01f8..9deb820 100644 (file)
@@ -1529,6 +1529,8 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     av_dlog(c->fc, "keyframe_count = %d\n", entries);
 
 
     av_dlog(c->fc, "keyframe_count = %d\n", entries);
 
+    if (!entries)
+        return 0;
     if (entries >= UINT_MAX / sizeof(int))
         return AVERROR_INVALIDDATA;
     sc->keyframes = av_malloc(entries * sizeof(int));
     if (entries >= UINT_MAX / sizeof(int))
         return AVERROR_INVALIDDATA;
     sc->keyframes = av_malloc(entries * sizeof(int));