diff mbox

[FFmpeg-devel,2/6] avcodec/dca_xll: Fix runtime error: signed integer overflow: 2147286116 + 6298923 cannot be represented in type 'int'

Message ID 20170308222843.9289-2-michael@niedermayer.cc
State Superseded
Headers show

Commit Message

Michael Niedermayer March 8, 2017, 10:28 p.m. UTC
Fixes: 732/clusterfuzz-testcase-4872990070145024

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

Comments

wm4 March 9, 2017, 7 a.m. UTC | #1
On Wed,  8 Mar 2017 23:28:39 +0100
Michael Niedermayer <michael@niedermayer.cc> wrote:

> Fixes: 732/clusterfuzz-testcase-4872990070145024
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/dca_xll.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c
> index 6cebda35e4..551774ebc6 100644
> --- a/libavcodec/dca_xll.c
> +++ b/libavcodec/dca_xll.c
> @@ -1312,7 +1312,7 @@ static int combine_residual_frame(DCAXllDecoder *s, DCAXllChSet *c)
>          } else {
>              // No downmix scaling
>              for (n = 0; n < nsamples; n++)
> -                dst[n] += (src[n] + round) >> shift;
> +                dst[n] += (SUINT)((src[n] + round) >> shift);
>          }
>      }
>  

I'm kind of against this SUINT stuff spreading.

Changing the sign depending on debug mode? Sounds horrible.
diff mbox

Patch

diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c
index 6cebda35e4..551774ebc6 100644
--- a/libavcodec/dca_xll.c
+++ b/libavcodec/dca_xll.c
@@ -1312,7 +1312,7 @@  static int combine_residual_frame(DCAXllDecoder *s, DCAXllChSet *c)
         } else {
             // No downmix scaling
             for (n = 0; n < nsamples; n++)
-                dst[n] += (src[n] + round) >> shift;
+                dst[n] += (SUINT)((src[n] + round) >> shift);
         }
     }