avcodec/aacpsdsp_template: Fix undefined integer overflow in ps_add_squares_c()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 26 Aug 2017 12:08:51 +0000 (14:08 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 27 Aug 2017 17:40:28 +0000 (19:40 +0200)
Fixes runtime error: signed integer overflow: 1997494407 + 613252359 cannot be represented in type 'int'
Fixes: 2014/clusterfuzz-testcase-minimized-5186337030275072

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/aacpsdsp_template.c

index 9e1a95c..e35e969 100644 (file)
@@ -30,7 +30,7 @@ static void ps_add_squares_c(INTFLOAT *dst, const INTFLOAT (*src)[2], int n)
 {
     int i;
     for (i = 0; i < n; i++)
-        dst[i] += AAC_MADD28(src[i][0], src[i][0], src[i][1], src[i][1]);
+        dst[i] += (UINTFLOAT)AAC_MADD28(src[i][0], src[i][0], src[i][1], src[i][1]);
 }
 
 static void ps_mul_pair_single_c(INTFLOAT (*dst)[2], INTFLOAT (*src0)[2], INTFLOAT *src1,