]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/dpx: Check bits_per_color earlier
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 11 Apr 2021 19:04:12 +0000 (21:04 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 17 Apr 2021 14:53:17 +0000 (16:53 +0200)
Fixes: shift exponent 251 is too large for 32-bit type 'int'
Fixes: 32147/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DPX_fuzzer-5519111675314176
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/dpx.c

index 5372e3d5861c3d4738c5d1405b1be80a3567b939..b02996f04c6635b6a4bb3ea10da41a65f947f889 100644 (file)
@@ -242,6 +242,9 @@ static int decode_frame(AVCodecContext *avctx,
         return AVERROR_PATCHWELCOME;
     }
 
+    if (bits_per_color > 32)
+        return AVERROR_INVALIDDATA;
+
     buf += 820;
     avctx->sample_aspect_ratio.num = read32(&buf, endian);
     avctx->sample_aspect_ratio.den = read32(&buf, endian);