diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-06-09 21:25:58 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-10-09 22:02:20 +0200 |
commit | 219839f311b9a9903b09fc976864ad26179add73 (patch) | |
tree | 0cab67e80245f9f7f04225c395b2f44dbe8842b1 | |
parent | 1eaabed791b9587993b4360334d6ee0e34d4abd1 (diff) | |
download | ffmpeg-219839f311b9a9903b09fc976864ad26179add73.tar.gz |
avcodec/faxcompr: Check available bits in decode_uncompressed()
Fixes: Timeout
Fixes: 34950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5686764151898112
Fixes: 34966/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4587409334468608
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 ff56c139e07a4de2803b974b6595f6b71fbf53bd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/faxcompr.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c index 7febcaa763..0392c72519 100644 --- a/libavcodec/faxcompr.c +++ b/libavcodec/faxcompr.c @@ -141,6 +141,8 @@ static int decode_uncompressed(AVCodecContext *avctx, GetBitContext *gb, return AVERROR_INVALIDDATA; } cwi = 10 - av_log2(cwi); + if (get_bits_left(gb) < cwi + 1) + return AVERROR_INVALIDDATA; skip_bits(gb, cwi + 1); if (cwi > 5) { newmode = get_bits1(gb); |