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 18:24:47 +0200
commit288ef1939f633da9cebca791215a2a2130ef6f3c (patch)
treee6606db6359ae88b2520d5633a6bf76c11212dbe
parentcd894807feda1cf23d21b2330989c4d239ecf22b (diff)
downloadffmpeg-288ef1939f633da9cebca791215a2a2130ef6f3c.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> (cherry picked from commit 15785e044ee1265464bb4f3ed727e2a8074f97b4) 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 01ddcaa512..fd8088f16c 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;
}