[FFmpeg-devel] [PATCH] avcodec/rasc: Check input space before reading chunk

Michael Niedermayer michael at niedermayer.cc
Wed Dec 5 04:05:58 EET 2018


Fixes: Timeout
Fixes: 11118/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5652564066959360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/rasc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/rasc.c b/libavcodec/rasc.c
index e8e0740ddd..67351dfd19 100644
--- a/libavcodec/rasc.c
+++ b/libavcodec/rasc.c
@@ -680,6 +680,9 @@ static int decode_frame(AVCodecContext *avctx,
     while (bytestream2_get_bytes_left(gb) > 0) {
         unsigned type, size = 0;
 
+        if (bytestream2_get_bytes_left(gb) < 8)
+            return AVERROR_INVALIDDATA;
+
         type = bytestream2_get_le32(gb);
         if (type == KBND || type == BNDL) {
             intra = type == KBND;
-- 
2.19.2



More information about the ffmpeg-devel mailing list