1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

opus_pvq: prevent division by 0

res was 0 and divided K which made it infinity which caused K to
overflow.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit is contained in:
Rostislav Pehlivanov 2017-02-24 19:13:44 +00:00
parent e01c32f260
commit 70259737cb

View File

@ -397,7 +397,7 @@ static void celt_pvq_search(float *X, int *y, int K, int N)
for (i = 0; i < N; i++)
res += FFABS(X[i]);
res = K/res;
res = K/(res + FLT_EPSILON);
for (i = 0; i < N; i++) {
y[i] = lrintf(res*X[i]);