[FFmpeg-cvslog] avcodec/faxcompr: Check remaining bits on error in decode_group3_1d_line()

Michael Niedermayer git at videolan.org
Fri Jun 18 22:13:50 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Thu Apr 15 20:08:22 2021 +0200| [7f0353bc550f63825f38b68d5451a9721ad053b1] | committer: Michael Niedermayer

avcodec/faxcompr: Check remaining bits on error in decode_group3_1d_line()

Fixes: Timeout
Fixes: 32886/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4779761466474496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 7b3881f0da6da00cb6b5b123328e2fbfca936c47)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/faxcompr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
index 3dd64cf730..7bf11d80ca 100644
--- a/libavcodec/faxcompr.c
+++ b/libavcodec/faxcompr.c
@@ -227,7 +227,7 @@ static int decode_group3_1d_line(AVCodecContext *avctx, GetBitContext *gb,
             run       = 0;
             mode      = !mode;
         } else if ((int)t == -1) {
-            if (show_bits(gb, 12) == 15) {
+            if (get_bits_left(gb) > 12 && show_bits(gb, 12) == 15) {
                 int ret;
                 skip_bits(gb, 12);
                 ret = decode_uncompressed(avctx, gb, &pix_left, &runs, runend, &mode);



More information about the ffmpeg-cvslog mailing list