diff mbox series

[FFmpeg-devel,2/2] avcodec/pcm: Fix invalid shift in AV_CODEC_ID_PCM_LXF

Message ID 20200221113832.13969-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/2] avcodec/sonic: Fix several integer overflows
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Feb. 21, 2020, 11:38 a.m. UTC
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
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Feb. 21, 2020, 11:42 a.m. UTC | #1
probably ok

On 2/21/20, Michael Niedermayer <michael@niedermayer.cc> wrote:
> 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
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/pcm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
> index 6346510de0..96a68f7fe8 100644
> --- a/libavcodec/pcm.c
> +++ b/libavcodec/pcm.c
> @@ -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
> -                *dst_int32_t++ =  (src[4]         << 24) |
> +                *dst_int32_t++ =  ((uint32_t)src[4]<<24) |
>                                    (src[3]         << 16) |
>                                   ((src[2] & 0xF0) <<  8) |
>                                    (src[4]         <<  4) |
> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Feb. 21, 2020, 8:33 p.m. UTC | #2
On Fri, Feb 21, 2020 at 12:42:07PM +0100, Paul B Mahol wrote:
> probably ok

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 6346510de0..96a68f7fe8 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -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
-                *dst_int32_t++ =  (src[4]         << 24) |
+                *dst_int32_t++ =  ((uint32_t)src[4]<<24) |
                                   (src[3]         << 16) |
                                  ((src[2] & 0xF0) <<  8) |
                                   (src[4]         <<  4) |