diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-06-21 21:02:39 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-09 13:54:52 +0200 |
commit | 9b6158958c75c35e71be817a34fdc62493abdb1e (patch) | |
tree | dc635a823d1bb9e641b9bd56ab843891a3ab224e | |
parent | 2beb60777f3bea20d71a0dbc9453004898040790 (diff) | |
download | ffmpeg-9b6158958c75c35e71be817a34fdc62493abdb1e.tar.gz |
avcodec/clearvideo: Check tile_size to be not too large
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 35023/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-6740166587842560
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 11fac9613e6a340d4d9968e2d8a43c3726ab57d3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/clearvideo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index 551867bc11..6f6af2edc6 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -665,8 +665,8 @@ static av_cold int clv_decode_init(AVCodecContext *avctx) } c->tile_shift = av_log2(c->tile_size); - if (1U << c->tile_shift != c->tile_size || c->tile_shift < 1) { - av_log(avctx, AV_LOG_ERROR, "Tile size: %d, is not power of 2 > 1\n", c->tile_size); + if (1U << c->tile_shift != c->tile_size || c->tile_shift < 1 || c->tile_shift > 30) { + av_log(avctx, AV_LOG_ERROR, "Tile size: %d, is not power of 2 > 1 and < 2^31\n", c->tile_size); return AVERROR_INVALIDDATA; } |