]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/exr: Check col/line for integer overflow
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 1 Feb 2021 20:24:50 +0000 (21:24 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 13 Mar 2021 20:02:31 +0000 (21:02 +0100)
Fixes: signed integer overflow: -2272 + -2147483360 cannot be represented in type 'int'
Fixes: 30009/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5005660322398208
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/exr.c

index 8a714c1a3a99c7ffbf1fcceb98852f71031ed545..279cfe9412857606b0690882b8cd1a22ef535ba7 100644 (file)
@@ -1214,6 +1214,11 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
             return AVERROR_PATCHWELCOME;
         }
 
+        if (tile_x && s->tile_attr.xSize + (int64_t)FFMAX(s->xmin, 0) >= INT_MAX / tile_x )
+            return AVERROR_INVALIDDATA;
+        if (tile_y && s->tile_attr.ySize + (int64_t)FFMAX(s->ymin, 0) >= INT_MAX / tile_y )
+            return AVERROR_INVALIDDATA;
+
         line = s->ymin + s->tile_attr.ySize * tile_y;
         col = s->tile_attr.xSize * tile_x;