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>
This commit is contained in:
Michael Niedermayer 2021-06-21 21:02:39 +02:00
parent 00ae9b77ef
commit 11fac9613e
1 changed files with 2 additions and 2 deletions

View File

@ -722,8 +722,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;
}