[FFmpeg-cvslog] avcodec/magicyuv: Check slice size before reading flags and pred
Michael Niedermayer
git at videolan.org
Sat Oct 24 16:54:44 EEST 2020
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Oct 23 20:39:33 2020 +0200| [0dc42147b6843b133d4fa46bf1c2568a837b4bec] | committer: Michael Niedermayer
avcodec/magicyuv: Check slice size before reading flags and pred
Fixes: heap-buffer-overflow
Fixes: 26487/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MAGICYUV_fuzzer-5742553675333632
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0dc42147b6843b133d4fa46bf1c2568a837b4bec
---
libavcodec/magicyuv.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index ea1f727e5c..f13351e5b5 100644
--- a/libavcodec/magicyuv.c
+++ b/libavcodec/magicyuv.c
@@ -623,6 +623,9 @@ static int magy_decode_frame(AVCodecContext *avctx, void *data,
s->slices[i][j].start = offset + header_size;
s->slices[i][j].size = avpkt->size - s->slices[i][j].start;
+
+ if (s->slices[i][j].size < 2)
+ return AVERROR_INVALIDDATA;
}
if (bytestream2_get_byteu(&gb) != s->planes)
More information about the ffmpeg-cvslog
mailing list