[FFmpeg-cvslog] aacenc_tns: fix out-of-bounds array access

Rostislav Pehlivanov git at videolan.org
Sat Aug 29 20:26:08 CEST 2015


ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Sat Aug 29 19:21:35 2015 +0100| [e924967fd5ec240cf97022f054cb02a0bc7101d9] | committer: Rostislav Pehlivanov

aacenc_tns: fix out-of-bounds array access

Since the coefficients are stepped up to order + 1 it was possible
that it went over TNS_MAX_ORDER. Also just return in case the only
coefficient is less than the threshold.

Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e924967fd5ec240cf97022f054cb02a0bc7101d9
---

 libavcodec/aacenc_tns.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/aacenc_tns.c b/libavcodec/aacenc_tns.c
index 0b22b67..a7433a8 100644
--- a/libavcodec/aacenc_tns.c
+++ b/libavcodec/aacenc_tns.c
@@ -97,6 +97,10 @@ static void process_tns_coeffs(TemporalNoiseShaping *tns, double *coef_raw,
             break;
         }
     }
+    order = av_clip(order, 0, TNS_MAX_ORDER - 1);
+    *order_p = order;
+    if (!order)
+        return;
 
     /* Step up procedure, convert to LPC coeffs */
     out[0] = 1.0f;
@@ -109,7 +113,6 @@ static void process_tns_coeffs(TemporalNoiseShaping *tns, double *coef_raw,
         }
         out[i] = lpc[i-1];
     }
-    *order_p = order;
     memcpy(lpc, out, TNS_MAX_ORDER*sizeof(float));
 }
 



More information about the ffmpeg-cvslog mailing list