[FFmpeg-devel] [PATCH 4/4] avcodec/faxcompr: Check for invalid VLC in decode_group3_1d_line()

Michael Niedermayer michael at niedermayer.cc
Wed Apr 28 18:06:36 EEST 2021


Fixes: infinite loop
Fixes: 33674/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4816457818046464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/faxcompr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
index 7bf11d80ca..f1f7e67762 100644
--- a/libavcodec/faxcompr.c
+++ b/libavcodec/faxcompr.c
@@ -213,7 +213,7 @@ static int decode_group3_1d_line(AVCodecContext *avctx, GetBitContext *gb,
         run += t;
         if (t < 64) {
             *runs++ = run;
-            if (runs >= runend) {
+            if (runs >= runend || t < 0) {
                 av_log(avctx, AV_LOG_ERROR, "Run overrun\n");
                 return AVERROR_INVALIDDATA;
             }
-- 
2.17.1



More information about the ffmpeg-devel mailing list