mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/exr: Check buf_size more completely
Fixes: Out of heap array read
Fixes: 4683/clusterfuzz-testcase-minimized-6152313673613312
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 903be5e4f6
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
b9a8b4f279
commit
d304d7e794
|
@ -847,7 +847,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
|||
|
||||
line_offset = AV_RL64(s->gb.buffer + jobnr * 8);
|
||||
// Check if the buffer has the required bytes needed from the offset
|
||||
if (line_offset > buf_size - 8)
|
||||
if (buf_size < 8 || line_offset > buf_size - 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
src = buf + line_offset + 8;
|
||||
|
@ -856,7 +856,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
|||
return AVERROR_INVALIDDATA;
|
||||
|
||||
data_size = AV_RL32(src - 4);
|
||||
if (data_size <= 0 || data_size > buf_size)
|
||||
if (data_size <= 0 || data_size > buf_size - line_offset - 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
s->ysize = FFMIN(s->scan_lines_per_block, s->ymax - line + 1);
|
||||
|
|
Loading…
Reference in New Issue