aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-06-09 21:20:04 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-17 21:34:53 +0200
commit7d575feadf00ab387a9124ed4f1ef946fde1312e (patch)
tree5ab88ccb2169be389d564b8a9d6db11c113ad736
parent86c5a34b7a8d0c35b253f14b34a72e554d4e7b61 (diff)
downloadffmpeg-7d575feadf00ab387a9124ed4f1ef946fde1312e.tar.gz
avcodec/faxcompr: Check if bits are available before reading in cmode == 9 || cmode == 10
Fixes: Timeout Fixes: 34950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5686764151898112 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 7d8421e3d5bc1300687a65384baccbcb3874b7ac) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/faxcompr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
index 469999e046..7febcaa763 100644
--- a/libavcodec/faxcompr.c
+++ b/libavcodec/faxcompr.c
@@ -301,7 +301,10 @@ static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb,
mode = !mode;
}
} else if (cmode == 9 || cmode == 10) {
- int xxx = get_bits(gb, 3);
+ int xxx;
+ if (get_bits_left(gb) < 3)
+ return AVERROR_INVALIDDATA;
+ xxx = get_bits(gb, 3);
if (cmode == 9 && xxx == 7) {
int ret;
int pix_left = width - offs;