summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-02-01 20:11:47 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-22 17:59:11 +0100
commit497e7473877243ff8ae02d8701aaf7854b9b57bf (patch)
tree27cd8927c2d430351a285cef44b9f0b6f4812250
parent52cc323735ced6e8095cfd3acea0e36e35c76eb2 (diff)
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@niedermayer.cc>
-rw-r--r--libavcodec/cri.c3
1 files changed, 3 insertions, 0 deletions
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;
}