[FFmpeg-devel,3/4] avcodec/smacker: Fix integer overflow in signed int multiply in SMK_BLK_FILL

Submitted by Michael Niedermayer on Sept. 6, 2019, 10:47 a.m.

Details

Message ID 20190906104747.10286-3-michael@niedermayer.cc
State Accepted
Commit 033d2c4884eca3f4f80047bff93255b0cc4fa7a3
Headers show

Commit Message

Michael Niedermayer Sept. 6, 2019, 10:47 a.m.
Fixes: signed integer overflow: 238 * 16843009 cannot be represented in type 'int'
Fixes: 16958/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5193905355620352

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

Patch hide | download patch | download mbox

diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index c45137b7d5..a2950c455b 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -543,7 +543,7 @@  static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
             while(run-- && blk < blocks){
                 uint32_t col;
                 out = smk->pic->data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4;
-                col = mode * 0x01010101;
+                col = mode * 0x01010101U;
                 for(i = 0; i < 4; i++) {
                     *((uint32_t*)out) = col;
                     out += stride;