[FFmpeg-cvslog] avcodec/exr: Check buf_size more completely
Michael Niedermayer
git at videolan.org
Thu Feb 1 01:52:46 EET 2018
ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Fri Dec 29 03:00:19 2017 +0100| [0abf465dc561ef219c58318852c624ce29456c01] | committer: Michael Niedermayer
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 at niedermayer.cc>
(cherry picked from commit 903be5e4f66268273dc6e3c42a7fdeaab32066ef)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0abf465dc561ef219c58318852c624ce29456c01
---
libavcodec/exr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 4000068172..a62a4c8a6f 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -846,7 +846,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;
@@ -855,7 +855,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);
More information about the ffmpeg-cvslog
mailing list