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

Carl Eugen Hoyos cehoyos at ag.or.at
Sun Dec 18 01:59:44 CET 2011


Hi!

On Saturday 17 December 2011 01:07:30 pm Vitor Sessak wrote:
> On Thu, Dec 15, 2011 at 11:52 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> > +        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)?

New patch attached.

Thank you, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/acelp_vectors.c b/libavcodec/acelp_vectors.c
index a44ab8c..e6db556 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 > 0)
         do {
             out[x] += y;
             y *= in->pitch_fac;
@@ -252,6 +253,7 @@ void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size)
     for (i=0; i < in->n; i++) {
         int x  = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1);
 
+        if (in->pitch_lag > 0)
         do {
             out[x] = 0.0;
             x += in->pitch_lag;


More information about the ffmpeg-devel mailing list