shithub: libsamplerate

Download patch

ref: 7c49952d2096e49d81731f22344fcd752fbfe2d5
parent: 873764f598069ffd6574d8a5b6d73860e1d0a9ee
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Mon Aug 24 16:59:39 EDT 2009

src/src_sinc.c : Fix a termination condition bug.

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-08-24  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
+
+    * tests/termination_test.c
+    Add test to detect a particular kind of termination error.
+
+    * src/src_sinc.c
+    Fix a termination condition bug.
+
 2009-06-25  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * src/samplerate.h
--- a/src/src_sinc.c
+++ b/src/src_sinc.c
@@ -1194,6 +1194,9 @@
 		filter->b_real_end = filter->b_end ;
 		len = half_filter_chan_len + 5 ;
 
+		if (len < 0 || filter->b_end + len > filter->b_len)
+			len = filter->b_len - filter->b_end ;
+
 		memset (filter->buffer + filter->b_end, 0, len * sizeof (filter->buffer [0])) ;
 		filter->b_end += len ;
 		} ;