ref: d633f523e36e3b6d01cc6d57386458d770d618be
parent: 794392ecd77e6fc6aafa62c3f6002780abcc2c7c
author: Mark Harris <mark.hsj@gmail.com>
date: Thu Nov 26 15:48:42 EST 2020
Fix float-approx negative left shift UB Reported by toto.
--- a/celt/mathops.h
+++ b/celt/mathops.h
@@ -137,7 +137,7 @@
} in;
in.f = x;
integer = (in.i>>23)-127;
- in.i -= integer<<23;
+ in.i -= (opus_uint32)integer<<23;
frac = in.f - 1.5f;
frac = -0.41445418f + frac*(0.95909232f
+ frac*(-0.33951290f + frac*0.16541097f));
@@ -160,7 +160,7 @@
/* K0 = 1, K1 = log(2), K2 = 3-4*log(2), K3 = 3*log(2) - 2 */
res.f = 0.99992522f + frac * (0.69583354f
+ frac * (0.22606716f + 0.078024523f*frac));
- res.i = (res.i + (integer<<23)) & 0x7fffffff;
+ res.i = (res.i + ((opus_uint32)integer<<23)) & 0x7fffffff;
return res.f;
}