diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-07-21 00:20:41 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-07-22 15:48:06 +0200 |
commit | 6a7842560450da25fb4184ff11dbb8b8791e8703 (patch) | |
tree | 59f6b510254cb9ea37febb709e5281574183b0a3 /libavcodec | |
parent | 288ef1939f633da9cebca791215a2a2130ef6f3c (diff) | |
download | ffmpeg-6a7842560450da25fb4184ff11dbb8b8791e8703.tar.gz |
avcodec/ffv1dec: Fix AC_GOLOMB_RICE min size check
Found-by: mkver
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f7d510b33ff33d2f5cb096017ee1c00f624cc138)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/ffv1dec.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index fd8088f16c..9300297267 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -884,9 +884,13 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, return AVERROR_INVALIDDATA; } else { int w = avctx->width; - for (int i = 0; w > (1<<ff_log2_run[i]); i++) + int s = 1 + w / (1<<23); + + w /= s; + + for (i = 0; w > (1<<ff_log2_run[i]); i++) w -= ff_log2_run[i]; - if (buf_size < (avctx->height + i + 6)/ 8) + if (buf_size < (avctx->height + i + 6) / 8 * s) return AVERROR_INVALIDDATA; } |