[FFmpeg-devel] [PATCH] opus_silk: fix out of array read in silk_lsf2lpc

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sun Dec 13 22:51:31 CET 2015


nlsf can be negative, but a negative index for silk_cosine doesn't work.
---
 libavcodec/opus_silk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/opus_silk.c b/libavcodec/opus_silk.c
index 841d1ed..3ac83b8 100644
--- a/libavcodec/opus_silk.c
+++ b/libavcodec/opus_silk.c
@@ -941,7 +941,7 @@ static void silk_lsf2lpc(const int16_t nlsf[16], float lpcf[16], int order)
 
     /* convert the LSFs to LSPs, i.e. 2*cos(LSF) */
     for (k = 0; k < order; k++) {
-        int index = nlsf[k] >> 8;
+        int index = FFABS(nlsf[k]) >> 8;
         int offset = nlsf[k] & 255;
         int k2 = (order == 10) ? silk_lsf_ordering_nbmb[k] : silk_lsf_ordering_wb[k];
 
-- 
2.6.2


More information about the ffmpeg-devel mailing list