[FFmpeg-cvslog] avcodec/exr: x/ymax cannot be INT_MAX

Michael Niedermayer git at videolan.org
Thu May 27 20:14:51 EEST 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Apr 20 20:24:21 2021 +0200| [48342aa0750f83006582d1598b5f22297f6dbf83] | committer: Michael Niedermayer

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 at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=48342aa0750f83006582d1598b5f22297f6dbf83
---

 libavcodec/exr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index fed4c127b8..9377a89169 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1795,6 +1795,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
             ymax   = bytestream2_get_le32(gb);
 
             if (xmin > xmax || ymin > ymax ||
+                ymax == INT_MAX || xmax == INT_MAX ||
                 (unsigned)xmax - xmin >= INT_MAX ||
                 (unsigned)ymax - ymin >= INT_MAX) {
                 ret = AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list