[FFmpeg-devel] [PATCH]Fix an endless loop when decoding amr-nb

Vitor Sessak vitor1001 at gmail.com
Sat Dec 17 13:07:30 CET 2011


On Thu, Dec 15, 2011 at 11:52 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Hi!
>
> Attached patch fixes an endless loop with the sample from bug 151 for me.
>
> Please comment, Carl Eugen
>
> -------------- next part --------------
> diff --git a/libavcodec/acelp_vectors.c b/libavcodec/acelp_vectors.c
> index a44ab8c..5916b88 100644
> --- a/libavcodec/acelp_vectors.c
> +++ b/libavcodec/acelp_vectors.c
> @@ -237,6 +237,7 @@ void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size)
>          int x   = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1);
>          float y = in->y[i] * scale;
>
> +        if (in->pitch_lag)
>          do {
>              out[x] += y;
>              y *= in->pitch_fac;

Since we are adding a check anyway, why not check (in->pitch_lag > 0)?

-Vitor


More information about the ffmpeg-devel mailing list