[FFmpeg-devel] [PATCH 2/3] avformat/vividas: Fix invalid shift in decode_key()

Michael Niedermayer michael at niedermayer.cc
Sat Jun 8 00:56:18 EEST 2019


Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 15118/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5740230004441088

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/vividas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index c99cbd1f6e..5e303b9c52 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -91,7 +91,7 @@ static uint32_t decode_key(uint8_t *buf)
 
     for (int i = 0; i < 32; i++) {
         unsigned p = keybits[i];
-        key |= !!(buf[p>>3] & (1<<(p&7))) << i;
+        key |= (unsigned)!!(buf[p>>3] & (1<<(p&7))) << i;
     }
 
     return key;
-- 
2.21.0



More information about the ffmpeg-devel mailing list