[FFmpeg-devel,6/6] avcodec/clearvideo: fix invalid shift in tile size check

Submitted by Michael Niedermayer on July 13, 2019, 8:25 p.m.

Details

Message ID 20190713202506.14871-6-michael@niedermayer.cc
State Accepted
Commit 5dc94924d0fbdedba4356c21ec7de0347b8e4757
Headers show

Commit Message

Michael Niedermayer July 13, 2019, 8:25 p.m.
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Aug. 3, 2019, 3:16 p.m.
On Sat, Jul 13, 2019 at 10:25:06PM +0200, Michael Niedermayer wrote:
> 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
index 82df8f3752..26cdfb2731 100644
--- a/libavcodec/clearvideo.c
+++ b/libavcodec/clearvideo.c
@@ -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;
     }