aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-11 21:04:12 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-17 21:34:53 +0200
commitaf78179b4d09cfd11f4392da8f44803b8fd1770c (patch)
treea4128dc358d82c536a1e0b0667e9442b7df64fa1
parent0b2d4997bade5a5ccdd640e6b645006c0a4e2e3c (diff)
downloadffmpeg-af78179b4d09cfd11f4392da8f44803b8fd1770c.tar.gz
avcodec/dpx: Check bits_per_color earlier
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> (cherry picked from commit c093eb30311b7148a4da1c7555498187c8cdf0db) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dpx.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index af7276adbf..582b8b7e23 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -147,6 +147,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);