Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2012-11-30 01:51:06 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-11-30 01:51:50 +0400
commitc3273ed7e79045183281d1d80a6b6b86839d197d (patch)
treea8724a3f90a150e4bbe03623048c0957c0dc6165
parente0491e7d18038b4bcd21c290dae51dfe019977ef (diff)
Fixes an overflow in the fixed-point celt_sqrt() for large values.
Was causing problems with the PLC
-rw-r--r--celt/mathops.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/celt/mathops.c b/celt/mathops.c
index ce472c9f..21fd9429 100644
--- a/celt/mathops.c
+++ b/celt/mathops.c
@@ -123,6 +123,8 @@ opus_val32 celt_sqrt(opus_val32 x)
static const opus_val16 C[5] = {23175, 11561, -3011, 1699, -664};
if (x==0)
return 0;
+ else if (x>=1073741824)
+ return 32767;
k = (celt_ilog2(x)>>1)-7;
x = VSHR32(x, 2*k);
n = x-32768;