diff options
author | Rostislav Pehlivanov <atomnuker@gmail.com> | 2017-02-24 19:13:44 +0000 |
---|---|---|
committer | Rostislav Pehlivanov <atomnuker@gmail.com> | 2017-02-24 19:14:55 +0000 |
commit | 70259737cbad1136d942fa0cca5d55be1ca37e0a (patch) | |
tree | fee4df84ba980c8a873430eee88a4caed8123b32 /libavcodec | |
parent | e01c32f260fa66fc80d286527a02cce7ca940c00 (diff) | |
download | ffmpeg-70259737cbad1136d942fa0cca5d55be1ca37e0a.tar.gz |
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>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/opus_pvq.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/opus_pvq.c b/libavcodec/opus_pvq.c index 706e239422..ce93c4731d 100644 --- a/libavcodec/opus_pvq.c +++ b/libavcodec/opus_pvq.c @@ -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]); |