[FFmpeg-cvslog] avcodec/cri: Stop the bitreader at the end of uncompressed input

Michael Niedermayer git at videolan.org
Mon Feb 22 18:59:57 EET 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Feb  1 20:11:47 2021 +0100| [497e7473877243ff8ae02d8701aaf7854b9b57bf] | committer: Michael Niedermayer

avcodec/cri: Stop the bitreader at the end of uncompressed input

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

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=497e7473877243ff8ae02d8701aaf7854b9b57bf
---

 libavcodec/cri.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/cri.c b/libavcodec/cri.c
index efbccf4fee..3312606b75 100644
--- a/libavcodec/cri.c
+++ b/libavcodec/cri.c
@@ -335,6 +335,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;
         }



More information about the ffmpeg-cvslog mailing list