diff mbox

[FFmpeg-devel] avcodec/pcm: Fix invalid shift in pcm_decode_frame for LXF

Message ID 20191217234721.4680-1-michael@niedermayer.cc
State Accepted
Headers show

Commit Message

Michael Niedermayer Dec. 17, 2019, 11:47 p.m. UTC
Fixes: left shift of 32 by 28 places cannot be represented in type 'int'
Fixes: 19472/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PCM_LXF_fuzzer-5704364320096256

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

Comments

Michael Niedermayer Feb. 2, 2020, 10:55 p.m. UTC | #1
On Wed, Dec 18, 2019 at 12:47:21AM +0100, Michael Niedermayer wrote:
> Fixes: left shift of 32 by 28 places cannot be represented in type 'int'
> Fixes: 19472/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PCM_LXF_fuzzer-5704364320096256
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/pcm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 4ce0b9487b..0c4b452b0e 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -515,7 +515,7 @@  static int pcm_decode_frame(AVCodecContext *avctx, void *data,
             dst_int32_t = (int32_t *)frame->extended_data[c];
             for (i = 0; i < n; i++) {
                 // extract low 20 bits and expand to 32 bits
-                *dst_int32_t++ =  (src[2]         << 28) |
+                *dst_int32_t++ =  ((uint32_t)src[2]<<28) |
                                   (src[1]         << 20) |
                                   (src[0]         << 12) |
                                  ((src[2] & 0x0F) <<  8) |