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

Michael Niedermayer michaelni at gmx.at
Mon Dec 14 02:38:05 CET 2015


On Sun, Dec 13, 2015 at 10:51:31PM +0100, Andreas Cadhalpun wrote:
> 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;

this looks a bit strange

if nlsf[] is allowed to be negative then i would have expected that
both nlsf[] would use the absolute value or if its nt allowed to be
negative then why is it ?

does the spec explain what should be done in this case ?
if not, its authors may want to amend it to clarify if this is
invalid or undefined or something specific should be done

[...]
--
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151214/520b457c/attachment.sig>


More information about the ffmpeg-devel mailing list