avcodec/clearvideo: fix invalid shift in tile size check
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 13 Jul 2019 18:16:19 +0000 (20:16 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 3 Aug 2019 15:44:23 +0000 (17:44 +0200)
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 15631/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-5690110605000704

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/clearvideo.c

index 82df8f3..26cdfb2 100644 (file)
@@ -665,7 +665,7 @@ static av_cold int clv_decode_init(AVCodecContext *avctx)
     }
 
     c->tile_shift = av_log2(c->tile_size);
-    if (1 << c->tile_shift != c->tile_size) {
+    if (1U << c->tile_shift != c->tile_size) {
         av_log(avctx, AV_LOG_ERROR, "Tile size: %d, is not power of 2.\n", c->tile_size);
         return AVERROR_INVALIDDATA;
     }