shithub: aubio

Download patch

ref: 4bb32f4babe960324b93d5db393d2feb59ea77a3
parent: 44d7cb7ef4eb8c9d20455deedbc27318143fb321
author: Paul Brossier <piem@piem.org>
date: Sat Nov 24 12:25:56 EST 2007

mathutils.c: fix invalid read in vec_moving_thres

--- a/src/mathutils.c
+++ b/src/mathutils.c
@@ -226,9 +226,9 @@
       medar[k] = vec->data[0][k+pos-post];
   /* pre part of the buffer does not exist */
   } else {
-    for (k=0;k<length-pos+post+1;k++)
+    for (k=0;k<length-pos+post;k++)
       medar[k] = vec->data[0][k+pos-post];
-    for (k=length-pos+post+1;k<win_length;k++)
+    for (k=length-pos+post;k<win_length;k++)
       medar[k] = 0.; /* 0-padding at the end */
   }
   return vec_median(tmpvec);