]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/rscc: Check inflated_buf size whan it is used
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 21 Nov 2020 23:31:47 +0000 (00:31 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 4 Feb 2021 16:20:41 +0000 (17:20 +0100)
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
libavcodec/rscc.c

index bd0520950ff323164344d4a0f73a3ea9f60ff5a6..07a7c3dca3b4723788a4856aa05f61446ede5e1c 100644 (file)
@@ -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);