]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mov: sanity check STSD entries
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 6 Feb 2021 20:54:31 +0000 (21:54 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 Feb 2021 18:55:02 +0000 (19:55 +0100)
The choosen value is arbitrary. I am not sure if this is a good idea
but i dont immedeately see an alternative better way, it seems either
an arbitrary limit or OOM

Fixes: OOM
Fixes: 27492/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6194970578649088
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c

index 2fd1f2cd8f038d985d3f5603d71a7ca55227216e..9ca0a3ee156417ed280bab7827feb2d2dc4d2f38 100644 (file)
@@ -2605,7 +2605,7 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     entries = avio_rb32(pb);
 
     /* Each entry contains a size (4 bytes) and format (4 bytes). */
-    if (entries <= 0 || entries > atom.size / 8) {
+    if (entries <= 0 || entries > atom.size / 8 || entries > 1024) {
         av_log(c->fc, AV_LOG_ERROR, "invalid STSD entries %d\n", entries);
         return AVERROR_INVALIDDATA;
     }