The encoder would crash in the PVQ search if fed NaNs via the float interface. This patch protects against it in two sufficient ways: Making the PVQ search robust against NaNs and by squashing NaNs to zero on input.
Thanks to David Richards for reporting this failure mode.
This commit is contained in:
parent
280c060bb1
commit
58ecb1ac15
2 changed files with 5 additions and 1 deletions
|
@ -223,7 +223,9 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B,
|
|||
#ifdef FIXED_POINT
|
||||
if (sum <= K)
|
||||
#else
|
||||
if (sum <= EPSILON)
|
||||
/* Prevents infinities and NaNs from causing too many pulses
|
||||
to be allocated. 64 is an approximation of infinity here. */
|
||||
if (!(sum > EPSILON && sum < 64))
|
||||
#endif
|
||||
{
|
||||
X[0] = QCONST16(1.f,14);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue