aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-07-31 21:17:23 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-12 11:22:04 +0200
commitf71c7a358e3ae9ceae681d722e6f350f3eab7976 (patch)
tree9773ada5067345c06d5e417321d88fed58868ade
parent2b4e4af6dcf4da83cd6c78404c535c7dd9a77b0d (diff)
downloadffmpeg-f71c7a358e3ae9ceae681d722e6f350f3eab7976.tar.gz
avcodec/faxcompr: Check for end of input in cmode == 1 in decode_group3_2d_line()
Fixes: Infinite loop Fixes: 35591/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4503764022198272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit f803635c4fac761ac68b39a369272d4c26433dc1) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/faxcompr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
index 0392c72519..5393fcf82b 100644
--- a/libavcodec/faxcompr.c
+++ b/libavcodec/faxcompr.c
@@ -280,6 +280,8 @@ static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb,
for (k = 0; k < 2; k++) {
run = 0;
for (;;) {
+ if (get_bits_left(gb) <= 0)
+ return AVERROR_INVALIDDATA;
t = get_vlc2(gb, ccitt_vlc[mode].table, 9, 2);
if (t == -1) {
av_log(avctx, AV_LOG_ERROR, "Incorrect code\n");