avutil/softfloat: Fix multiple runtime error: left shift of negative value -8
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 5 May 2017 22:13:05 +0000 (00:13 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 17 May 2017 18:35:19 +0000 (20:35 +0200)
Fixes: 1352/clusterfuzz-testcase-minimized-5757565017260032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 35f3df0d76e28969fa77f2b865e2e40b3ba69722)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavutil/softfloat.h

index 35fd703..8e28a0e 100644 (file)
@@ -214,12 +214,12 @@ static av_unused void av_sincos_sf(int a, int *s, int *c)
     int st, ct;
 
     idx = a >> 26;
-    sign = (idx << 27) >> 31;
+    sign = (int32_t)((unsigned)idx << 27) >> 31;
     cv = av_costbl_1_sf[idx & 0xf];
     cv = (cv ^ sign) - sign;
 
     idx -= 8;
-    sign = (idx << 27) >> 31;
+    sign = (int32_t)((unsigned)idx << 27) >> 31;
     sv = av_costbl_1_sf[idx & 0xf];
     sv = (sv ^ sign) - sign;