mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
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 9b72cea446
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
c4c59c19c2
commit
ff531c345c
@ -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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user