avoid out of boundaries write in yinfft
authorPaul Brossier <piem@altern.org>
Fri, 21 Jul 2006 13:42:07 +0000 (13:42 +0000)
committerPaul Brossier <piem@altern.org>
Fri, 21 Jul 2006 13:42:07 +0000 (13:42 +0000)
avoid out of boundaries write in yinfft

src/pitchyinfft.c

index 0c7b0f2e63c26871de14685bc3848b0cfa2e34d2..98fffe7fe94199a29f4edc4eb884e3e02bb39673 100644 (file)
@@ -101,9 +101,11 @@ smpl_t aubio_pitchyinfft_detect(aubio_pitchyinfft_t * p, fvec_t * input, smpl_t
   aubio_mfft_do(p->fft,p->winput,p->fftout);
   for (l=0; l < p->fftout->length; l++){
          p->sqrmag->data[0][l] = SQR(p->fftout->norm[0][l]);
-         p->sqrmag->data[0][(p->fftout->length-1)*2-l] = 
-               SQR(p->fftout->norm[0][l]);
          p->sqrmag->data[0][l] *= p->weight->data[0][l]; 
+  }
+  for (l=1; l < p->fftout->length; l++){
+         p->sqrmag->data[0][(p->fftout->length-1)*2-l] = 
+          SQR(p->fftout->norm[0][l]);
          p->sqrmag->data[0][(p->fftout->length-1)*2-l] *=
                 p->weight->data[0][l];
   }