avformat/mov: Check size of STSC allocation
authorFredrik Hubinette <hubbe@google.com>
Thu, 16 Nov 2017 01:24:30 +0000 (17:24 -0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 16 Nov 2017 22:26:36 +0000 (23:26 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c

index 79023ef..d49d820 100644 (file)
@@ -2595,6 +2595,8 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     avio_rb24(pb); /* flags */
 
     entries = avio_rb32(pb);
+    if ((uint64_t)entries * 12 + 4 > atom.size)
+        return AVERROR_INVALIDDATA;
 
     av_log(c->fc, AV_LOG_TRACE, "track[%u].stsc.entries = %u\n", c->fc->nb_streams - 1, entries);