[FFmpeg-cvslog] avcodec/rscc: Check inflated_buf size whan it is used

Michael Niedermayer git at videolan.org
Thu Feb 4 18:39:47 EET 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Nov 22 00:31:47 2020 +0100| [a5ed6da9bdbe32408aabe1c75e4b55fcaeec1e9b] | committer: Michael Niedermayer

avcodec/rscc: Check inflated_buf size whan it is used

Fixes: out of array access
Fixes: 27434/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RSCC_fuzzer-5196757675540480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

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

 libavcodec/rscc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c
index bd0520950f..07a7c3dca3 100644
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@ -300,6 +300,10 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
             ret = AVERROR_INVALIDDATA;
             goto end;
         }
+        if (ctx->inflated_size < pixel_size) {
+            ret = AVERROR_INVALIDDATA;
+            goto end;
+        }
         ret = uncompress(ctx->inflated_buf, &len, gbc->buffer, packed_size);
         if (ret) {
             av_log(avctx, AV_LOG_ERROR, "Pixel deflate error %d.\n", ret);



More information about the ffmpeg-cvslog mailing list