[FFmpeg-devel] [PATCH 6/7] avcodec/alsdec: Fix another integer overflow in INTERLEAVE_OUTPUT()

Michael Niedermayer michael at niedermayer.cc
Fri Jun 21 01:47:20 EEST 2019


Fixes: signed integer overflow: 41582592 * 256 cannot be represented in type 'int'
Fixes: 15296/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5739558227935232

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

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 57d558c1c6..8d68fa24e6 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1805,11 +1805,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
         if (!ctx->cs_switch) {                                                       \
             for (sample = 0; sample < ctx->cur_frame_length; sample++)               \
                 for (c = 0; c < avctx->channels; c++)                                \
-                    *dest++ = ctx->raw_samples[c][sample] * (1 << shift);            \
+                    *dest++ = ctx->raw_samples[c][sample] * (1U << shift);            \
         } else {                                                                     \
             for (sample = 0; sample < ctx->cur_frame_length; sample++)               \
                 for (c = 0; c < avctx->channels; c++)                                \
-                    *dest++ = ctx->raw_samples[sconf->chan_pos[c]][sample] * (1 << shift); \
+                    *dest++ = ctx->raw_samples[sconf->chan_pos[c]][sample] * (1U << shift); \
         }                                                                            \
     }
 
-- 
2.22.0



More information about the ffmpeg-devel mailing list