aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-20 20:24:21 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:20 +0200
commit68d77a55801ac16247120765cd7532a9e173c451 (patch)
tree072d67405d1b2271b230270614968b61eb0bc2d6
parent4588d46c378303445f86973beff00e555f69ecca (diff)
downloadffmpeg-68d77a55801ac16247120765cd7532a9e173c451.tar.gz
avcodec/exr: x/ymax cannot be INT_MAX
The code uses x/ymax + 1 so the maximum is INT_MAX-1 Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 33158/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5545462457303040 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 48342aa0750f83006582d1598b5f22297f6dbf83) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/exr.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 8c3427c21b..bd82017b98 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1493,6 +1493,7 @@ static int decode_header(EXRContext *s)
ymax = bytestream2_get_le32(&s->gb);
if (xmin > xmax || ymin > ymax ||
+ ymax == INT_MAX || xmax == INT_MAX ||
(unsigned)xmax - xmin >= INT_MAX ||
(unsigned)ymax - ymin >= INT_MAX) {
return AVERROR_INVALIDDATA;