[FFmpeg-devel] [PATCH 5/8] avcodec/cri: Stop the bitreader at the end of uncompressed input

Michael Niedermayer michael at niedermayer.cc
Tue Feb 2 00:31:13 EET 2021


Fixes: Timeout
Fixes: 29983/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CRI_fuzzer-6420415838814208

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

diff --git a/libavcodec/cri.c b/libavcodec/cri.c
index f7c3b4ef48..2d33b54e42 100644
--- a/libavcodec/cri.c
+++ b/libavcodec/cri.c
@@ -331,6 +331,9 @@ skip:
         for (int y = 0; y < avctx->height; y++) {
             uint16_t *dst = (uint16_t *)(p->data[0] + y * p->linesize[0]);
 
+            if (get_bits_left(&gbit) < avctx->width * bps)
+                break;
+
             for (int x = 0; x < avctx->width; x++)
                 dst[x] = get_bits(&gbit, bps) << shift;
         }
-- 
2.17.1



More information about the ffmpeg-devel mailing list