[FFmpeg-devel,4/4] avcodec/rasc: Check input size in decode_fint()

Submitted by Michael Niedermayer on Oct. 17, 2019, 10:25 p.m.

Details

Message ID 20191017222515.21382-4-michael@niedermayer.cc
State Accepted
Commit 17603094d57faf95bee00d557fe6de84a05352ef
Headers show

Commit Message

Michael Niedermayer Oct. 17, 2019, 10:25 p.m.
Fixes: Timeout (11sec -> 42ms)
Fixes: 18287/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5637866331308032

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

Patch hide | download patch | download mbox

diff --git a/libavcodec/rasc.c b/libavcodec/rasc.c
index 21fc43f325..cdf20a6db9 100644
--- a/libavcodec/rasc.c
+++ b/libavcodec/rasc.c
@@ -124,6 +124,8 @@  static int decode_fint(AVCodecContext *avctx,
         clear_plane(avctx, s->frame1);
         return 0;
     }
+    if (bytestream2_get_bytes_left(gb) < 72)
+        return AVERROR_INVALIDDATA;
 
     bytestream2_skip(gb, 8);
     w = bytestream2_get_le32(gb);