diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-06 14:28:20 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-17 20:35:20 +0200 |
commit | 9cd39ab7d3d4e73ed5051f82d1e16b0d57996751 (patch) | |
tree | 99a7be9829c65e9443d1174581c2ab9cd422b633 | |
parent | c82ea252e3d3fc5b5bf0fdeb4a5d18707a4ce0ba (diff) | |
download | ffmpeg-9cd39ab7d3d4e73ed5051f82d1e16b0d57996751.tar.gz |
avcodec/opus_silk: Fix integer overflow and out of array read
Fixes: 1362/clusterfuzz-testcase-minimized-6097275002552320
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4654baff125d937ae0b1037aa5f0bf53c7351658)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/opus_silk.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/opus_silk.c b/libavcodec/opus_silk.c index 73526f9800..408e4bf43c 100644 --- a/libavcodec/opus_silk.c +++ b/libavcodec/opus_silk.c @@ -851,8 +851,7 @@ static inline void silk_stabilize_lsf(int16_t nlsf[16], int order, const uint16_ if (nlsf[0] < min_delta[0]) nlsf[0] = min_delta[0]; for (i = 1; i < order; i++) - if (nlsf[i] < nlsf[i - 1] + min_delta[i]) - nlsf[i] = nlsf[i - 1] + min_delta[i]; + nlsf[i] = FFMAX(nlsf[i], FFMIN(nlsf[i - 1] + min_delta[i], 32767)); /* push backwards to increase distance */ if (nlsf[order-1] > 32768 - min_delta[order]) |