[FFmpeg-devel] [PATCH 2/3] avcodec/rpza: Check that there is enough data for all the blocks

Michael Niedermayer michael at niedermayer.cc
Sun Dec 16 22:43:06 EET 2018


Fixes: Timeout
Fixes: 11547/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RPZA_fuzzer-5678435842654208

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/rpza.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c
index cffbfe4416..8e1efa2445 100644
--- a/libavcodec/rpza.c
+++ b/libavcodec/rpza.c
@@ -105,6 +105,9 @@ static int rpza_decode_stream(RpzaContext *s)
     /* Number of 4x4 blocks in frame. */
     total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4);
 
+    if (total_blocks / 32 > bytestream2_get_bytes_left(&s->gb))
+        return AVERROR_INVALIDDATA;
+
     if ((ret = ff_reget_buffer(s->avctx, s->frame)) < 0)
         return ret;
     pixels = (uint16_t *)s->frame->data[0];
-- 
2.19.2



More information about the ffmpeg-devel mailing list