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
path: root/silk
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2018-09-27 05:57:36 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2018-09-27 05:57:36 +0300
commita8e2a2b1a8ab2cb9d9e7d4fe21128ac9e769fe4e (patch)
treec7d4ae16e50f6a8e08ef6af599579be9dc4b14fe /silk
parent5d290239f110af41f1e29b63b8008b5016e23a63 (diff)
Prevent the SILK counter from overflowing after 2 years and 9 months
or "just" 1 year and 4 months for 10-ms frames. The overflow can eventually cause a divide-by-zero when counter == -16 Thanks to Dmitry Malinin for reporting the bug.
Diffstat (limited to 'silk')
-rw-r--r--silk/VAD.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/silk/VAD.c b/silk/VAD.c
index 541e5056..d0cda521 100644
--- a/silk/VAD.c
+++ b/silk/VAD.c
@@ -312,6 +312,8 @@ void silk_VAD_GetNoiseLevels(
/* Initially faster smoothing */
if( psSilk_VAD->counter < 1000 ) { /* 1000 = 20 sec */
min_coef = silk_DIV32_16( silk_int16_MAX, silk_RSHIFT( psSilk_VAD->counter, 4 ) + 1 );
+ /* Increment frame counter */
+ psSilk_VAD->counter++;
} else {
min_coef = 0;
}
@@ -355,7 +357,4 @@ void silk_VAD_GetNoiseLevels(
/* Store as part of state */
psSilk_VAD->NL[ k ] = nl;
}
-
- /* Increment frame counter */
- psSilk_VAD->counter++;
}