[FFmpeg-cvslog] avcodec/msp2dec: Check available space in RLE decoder
Michael Niedermayer
git at videolan.org
Thu Apr 8 22:37:01 EEST 2021
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Apr 6 23:14:08 2021 +0200| [caaf4633117f77a545975dac18e85b8fcdbc9ce7] | committer: Michael Niedermayer
avcodec/msp2dec: Check available space in RLE decoder
Fixes: out of array read
Fixes: 32968/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSP2_fuzzer-5315296027082752
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=caaf4633117f77a545975dac18e85b8fcdbc9ce7
---
libavcodec/msp2dec.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavcodec/msp2dec.c b/libavcodec/msp2dec.c
index cc548d218a..16c5ac6f02 100644
--- a/libavcodec/msp2dec.c
+++ b/libavcodec/msp2dec.c
@@ -71,6 +71,7 @@ static int msp2_decode_frame(AVCodecContext *avctx,
while (bytestream2_get_bytes_left(&gb) && x < width) {
int size = bytestream2_get_byte(&gb);
if (size) {
+ size = FFMIN(size, bytestream2_get_bytes_left(&gb));
memcpy(p->data[0] + y * p->linesize[0] + x, gb.buffer, FFMIN(size, width - x));
bytestream2_skip(&gb, size);
} else {
More information about the ffmpeg-cvslog
mailing list