diff mbox

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

Message ID 20181205020558.28984-1-michael@niedermayer.cc
State Accepted
Commit 52ba824c65817c1db6aad41c470dde7162252036
Headers show

Commit Message

Michael Niedermayer Dec. 5, 2018, 2:05 a.m. UTC
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@niedermayer.cc>
---
 libavcodec/rasc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer Dec. 14, 2018, 9:27 p.m. UTC | #1
On Wed, Dec 05, 2018 at 03:05:58AM +0100, Michael Niedermayer wrote:
> 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@niedermayer.cc>
> ---
>  libavcodec/rasc.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply


[...]
diff mbox

Patch

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;