diff mbox series

[FFmpeg-devel,5/6] avcodec/alsdec: Fix integer overflow with quant_cof

Message ID 20201227174938.27369-5-michael@niedermayer.cc
State Accepted
Commit 7ce40dde03ea56684f2cb6b40991a90bc38c3ad9
Headers show
Series [FFmpeg-devel,1/6] avformat/mxfdec: Do not clear arrays in mxf_read_index_entry_array()
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Dec. 27, 2020, 5:49 p.m. UTC
Fixes: signed integer overflow: -210824 * 16384 cannot be represented in type 'int'
Fixes: 28670/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5682310846480384

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

Comments

Michael Niedermayer Jan. 5, 2021, 12:27 a.m. UTC | #1
On Sun, Dec 27, 2020 at 06:49:37PM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -210824 * 16384 cannot be represented in type 'int'
> Fixes: 28670/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5682310846480384
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

will apply

[...]
diff mbox series

Patch

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index c318ad088e..b3c444c54f 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -762,7 +762,7 @@  static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
             }
 
             for (k = 2; k < opt_order; k++)
-                quant_cof[k] = (quant_cof[k] * (1 << 14)) + (add_base << 13);
+                quant_cof[k] = (quant_cof[k] * (1U << 14)) + (add_base << 13);
         }
     }