diff mbox series

[FFmpeg-devel,3/4] avcodec/mlpdsp: Fix a invalid shift in ff_mlp_rematrix_channel()

Message ID 20200202001639.32084-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/4] avcodec/ac3dec_fixed: Fix several invalid left shifts in scale_coefs()
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. 2, 2020, 12:16 a.m. UTC
Fixes: left shift of negative value -2
Fixes: 20305/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5677196618498048

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

Comments

Jai Luthra Feb. 2, 2020, 8:37 a.m. UTC | #1
On Sun, Feb 02, 2020 at 01:16:38AM +0100, Michael Niedermayer wrote:
>Fixes: left shift of negative value -2
>Fixes: 20305/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5677196618498048
>
>Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
>Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
>---
> libavcodec/mlpdsp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c
>index 32a4503b64..12bef3a721 100644
>--- a/libavcodec/mlpdsp.c
>+++ b/libavcodec/mlpdsp.c
>@@ -79,7 +79,7 @@ void ff_mlp_rematrix_channel(int32_t *samples,
>
>         if (matrix_noise_shift) {
>             index &= access_unit_size_pow2 - 1;
>-            accum += noise_buffer[index] << (matrix_noise_shift + 7);
>+            accum += noise_buffer[index] * (1 << (matrix_noise_shift + 7));
>             index += index2;
>         }
>
>-- 
>2.17.1
>
>_______________________________________________


lgtm.

--
Jai

>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. 2, 2020, 4:05 p.m. UTC | #2
On Sun, Feb 02, 2020 at 02:07:14PM +0530, Jai Luthra wrote:
> On Sun, Feb 02, 2020 at 01:16:38AM +0100, Michael Niedermayer wrote:
> >Fixes: left shift of negative value -2
> >Fixes: 20305/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5677196618498048
> >
> >Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> >---
> >libavcodec/mlpdsp.c | 2 +-
> >1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c
> >index 32a4503b64..12bef3a721 100644
> >--- a/libavcodec/mlpdsp.c
> >+++ b/libavcodec/mlpdsp.c
> >@@ -79,7 +79,7 @@ void ff_mlp_rematrix_channel(int32_t *samples,
> >
> >        if (matrix_noise_shift) {
> >            index &= access_unit_size_pow2 - 1;
> >-            accum += noise_buffer[index] << (matrix_noise_shift + 7);
> >+            accum += noise_buffer[index] * (1 << (matrix_noise_shift + 7));
> >            index += index2;
> >        }
> >
> >-- 
> >2.17.1
> >
> >_______________________________________________
> 
> 
> lgtm.

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c
index 32a4503b64..12bef3a721 100644
--- a/libavcodec/mlpdsp.c
+++ b/libavcodec/mlpdsp.c
@@ -79,7 +79,7 @@  void ff_mlp_rematrix_channel(int32_t *samples,
 
         if (matrix_noise_shift) {
             index &= access_unit_size_pow2 - 1;
-            accum += noise_buffer[index] << (matrix_noise_shift + 7);
+            accum += noise_buffer[index] * (1 << (matrix_noise_shift + 7));
             index += index2;
         }