avcodec/pcm: Fix invalid shift in AV_CODEC_ID_PCM_LXF
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 20 Feb 2020 21:26:18 +0000 (22:26 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 21 Feb 2020 20:42:11 +0000 (21:42 +0100)
Fixes: left shift of 233 by 24 places cannot be represented in type 'int'
Fixes: 20736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PCM_LXF_fuzzer-4829212685107200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/pcm.c

index 6346510..96a68f7 100644 (file)
@@ -513,7 +513,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
                                  ((src[2] & 0x0F) <<  8) |
                                    src[1];
                 // extract high 20 bits and expand to 32 bits
                                  ((src[2] & 0x0F) <<  8) |
                                    src[1];
                 // extract high 20 bits and expand to 32 bits
-                *dst_int32_t++ =  (src[4]         << 24) |
+                *dst_int32_t++ =  ((uint32_t)src[4]<<24) |
                                   (src[3]         << 16) |
                                  ((src[2] & 0xF0) <<  8) |
                                   (src[4]         <<  4) |
                                   (src[3]         << 16) |
                                  ((src[2] & 0xF0) <<  8) |
                                   (src[4]         <<  4) |