ref: 995fe3298159a4b5a90d394f5a3b739a24d9aec4
parent: a2236768b3430b83754d178eca0646b11edc2fe8
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Wed Jul 2 09:51:41 EDT 2008
src/src_sinc.c : Fix buffer overrrun bug at extreme low conversion ratios.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-07-02 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+
+ * tests/downsample_test.c
+ New test file to test for buffer overrun bugs at extreme low conversion
+ ratios.
+
+ * tests/Makefile.am
+ Hook above test program into build.
+
+ * src/src_sinc.c
+ Fix buffer overrrun bug at extreme low conversion ratios. Thanks to Russell
+ O'Connor for the report.
+
2008-05-13 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* configure.ac
@@ -19,7 +32,7 @@
2008-03-17 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* tests/throughput_test.c
- Include config.h and float_cast.h." -- tests/throughput_test.c
+ Include config.h and float_cast.h." -- tests/throughput_test.c
* Make.bat Win32/*
Bunch more Win32 updates.
@@ -56,8 +69,8 @@
* src/old_high_qual_coeffs.h src/old_mid_qual_coeffs.h
Copy these from the old versions.
- * src/high_qual_coeffs.h src/mid_qual_coeffs.h
- New versions of the coefficients with improved SNR.
+ * src/high_qual_coeffs.h src/mid_qual_coeffs.h
+ New versions of the coefficients with improved SNR.
2008-02-10 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
--- a/src/src_sinc.c
+++ b/src/src_sinc.c
@@ -201,8 +201,8 @@
** a better way. Need to look at prepare_data () at the same time.
*/
- temp_filter.b_len = 1000 + 2 * lrint (0.5 + 2 * temp_filter.coeff_half_len / (temp_filter.index_inc * 1.0) * SRC_MAX_RATIO) ;
- temp_filter.b_len = MIN (temp_filter.b_len, 4096) ;
+ temp_filter.b_len = 2 * lrint (1.0 + temp_filter.coeff_half_len / (temp_filter.index_inc * 1.0) * SRC_MAX_RATIO) ;
+ temp_filter.b_len = MAX (temp_filter.b_len, 4096) ;
temp_filter.b_len *= temp_filter.channels ;
if ((filter = calloc (1, sizeof (SINC_FILTER) + sizeof (filter->buffer [0]) * (temp_filter.b_len + temp_filter.channels))) == NULL)