[FFmpeg-cvslog] avcodec/cdtoons: Check sprite_offset is within the packet

Michael Niedermayer git at videolan.org
Tue May 12 22:52:02 EEST 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon May 11 21:08:17 2020 +0200| [4d701e92223d046a9d52c3ae16897e492f045478] | committer: Michael Niedermayer

avcodec/cdtoons: Check sprite_offset is within the packet

Fixes: out of array read
Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDTOONS_fuzzer-5754518731227136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4d701e92223d046a9d52c3ae16897e492f045478
---

 libavcodec/cdtoons.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/cdtoons.c b/libavcodec/cdtoons.c
index 13f9a60f0f..a8609815c1 100644
--- a/libavcodec/cdtoons.c
+++ b/libavcodec/cdtoons.c
@@ -190,6 +190,9 @@ static int cdtoons_decode_frame(AVCodecContext *avctx, void *data,
     palette_set        = bytestream_get_byte(&buf);
     buf               += 5;
 
+    if (sprite_offset > buf_size)
+        return AVERROR_INVALIDDATA;
+
     /* read new sprites introduced in this frame */
     buf = avpkt->data + sprite_offset;
     while (sprite_count--) {



More information about the ffmpeg-cvslog mailing list