aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-07-19 01:25:01 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-07-20 16:13:20 +0200
commit15785e044ee1265464bb4f3ed727e2a8074f97b4 (patch)
tree9bca6fd554b3027330348a640a73b9dae52d95c1
parent3592b05c84958e2723cc026e7649df508de1a9c4 (diff)
downloadffmpeg-15785e044ee1265464bb4f3ed727e2a8074f97b4.tar.gz
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@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/ffv1dec.c5
1 files changed, 4 insertions, 1 deletions
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;
}