diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-09-26 22:04:16 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-09 13:37:21 +0200 |
commit | 13a10e107a6dd8e7b0a0319b0d53bf0b05b39abb (patch) | |
tree | 691d2a77244b53d5e516ec34dbe94c648ecaf482 | |
parent | 8a4aab7f0f3d61bc58c1d547192389ced0295c23 (diff) | |
download | ffmpeg-13a10e107a6dd8e7b0a0319b0d53bf0b05b39abb.tar.gz |
avcodec/exr: Check line size for overflow
Fixes: signed integer overflow: 570425356 * 6 cannot be represented in type 'int
Fixes: 25929/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5099197739827200
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 9b72cea4463dd2fabcd9ba1454a0855e521d0148)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/exr.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 4b417013f9..e35e4bfd7e 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1092,6 +1092,9 @@ static int decode_block(AVCodecContext *avctx, void *tdata, if ((col + td->xsize) != s->xdelta)/* not the last tile of the line */ axmax = 0; /* doesn't add pixel at the right of the datawindow */ + if (td->xsize * (uint64_t)s->current_channel_offset > INT_MAX) + return AVERROR_INVALIDDATA; + td->channel_line_size = td->xsize * s->current_channel_offset;/* uncompress size of one line */ uncompressed_size = td->channel_line_size * (uint64_t)td->ysize;/* uncompress size of the block */ } else { @@ -1111,6 +1114,9 @@ static int decode_block(AVCodecContext *avctx, void *tdata, td->ysize = FFMIN(s->scan_lines_per_block, s->ymax - line + 1); /* s->ydelta - line ?? */ td->xsize = s->xdelta; + if (td->xsize * (uint64_t)s->current_channel_offset > INT_MAX) + return AVERROR_INVALIDDATA; + td->channel_line_size = td->xsize * s->current_channel_offset;/* uncompress size of one line */ uncompressed_size = td->channel_line_size * (uint64_t)td->ysize;/* uncompress size of the block */ |