changeset 9446:1a3865d1b049 libavcodec

Fix possibly harmful outbound addressing. Patch by Kenan Gillet.
author reynaldo
date Wed, 15 Apr 2009 19:28:28 +0000
parents 41245484dc0b
children d7554a5e3fd7
files celp_filters.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/celp_filters.c	Wed Apr 15 19:10:16 2009 +0000
+++ b/celp_filters.c	Wed Apr 15 19:28:28 2009 +0000
@@ -61,15 +61,14 @@
 {
     int i,n;
 
-    // These two lines are to avoid a -1 subtraction in the main loop
+    // This line is to avoid a +1 subtraction in the main loop.
     filter_length++;
-    filter_coeffs--;
 
     for(n=0; n<buffer_length; n++)
     {
         int sum = rounder;
         for(i=1; i<filter_length; i++)
-            sum -= filter_coeffs[i] * out[n-i];
+            sum -= filter_coeffs[i-1] * out[n-i];
 
         sum = (sum >> 12) + in[n];
 
@@ -94,14 +93,13 @@
 {
     int i,n;
 
-    // These two lines are to avoid a -1 subtraction in the main loop
+    // This line is to avoid a +1 subtraction in the main loop
     filter_length++;
-    filter_coeffs--;
 
     for(n=0; n<buffer_length; n++)
     {
         out[n] = in[n];
         for(i=1; i<filter_length; i++)
-            out[n] -= filter_coeffs[i] * out[n-i];
+            out[n] -= filter_coeffs[i-1] * out[n-i];
     }
 }