[FFmpeg-cvslog] avcodec/ffv1dec: consider run increase in minimal golomb frame size

Michael Niedermayer git at videolan.org
Wed Jul 20 17:34:20 EEST 2022


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Jul 19 01:25:01 2022 +0200| [15785e044ee1265464bb4f3ed727e2a8074f97b4] | committer: Michael Niedermayer

avcodec/ffv1dec: consider run increase in minimal golomb frame size

Fixes: Timeout
Fixes: 49160/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5672826144686080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/ffv1dec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index c7efd0bb45..d71584505d 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -883,7 +883,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
         if (buf_size < avctx->width * avctx->height / (128*8))
             return AVERROR_INVALIDDATA;
     } else {
-        if (buf_size < avctx->height / 8)
+        int w = avctx->width;
+        for (int i = 0; w > (1<<ff_log2_run[i]); i++)
+            w -= ff_log2_run[i];
+        if (buf_size < (avctx->height + i + 6)/ 8)
             return AVERROR_INVALIDDATA;
     }
 



More information about the ffmpeg-cvslog mailing list