shithub: libsamplerate

Download patch

ref: 6707f5c0166c331e62c2c14f75ef6baf6d96b706
parent: f2e382343880152fc5b34d55aa162d1b25ddf1b7
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Wed Oct 7 17:52:37 EDT 2009

src/src_(linear|zoh).c : Fix for bug in zero_input_test(). Both these converters crashed if the input_frames field of SRC_DATA was zero.

--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
     * tests/misc_test.c
     Add zero_input_test() from debian bug #506722.
 
+    * src/src_linear.c src/src_zoh.c
+    Fix for bug in zero_input_test(). Both these converters crashed if the
+    input_frames field of SRC_DATA was zero.
+
 2009-09-16  Erik de Castro Lopo  <erikd AT mega-nerd DOT com>
 
     * M4/endian.m4
--- a/src/src_linear.c
+++ b/src/src_linear.c
@@ -58,6 +58,9 @@
 	double		src_ratio, input_index, rem ;
 	int			ch ;
 
+	if (data->input_frames <= 0)
+		return SRC_ERR_NO_ERROR ;
+
 	if (psrc->private_data == NULL)
 		return SRC_ERR_NO_PRIVATE ;
 
--- a/src/src_zoh.c
+++ b/src/src_zoh.c
@@ -56,6 +56,9 @@
 	double		src_ratio, input_index, rem ;
 	int			ch ;
 
+	if (data->input_frames <= 0)
+		return SRC_ERR_NO_ERROR ;
+
 	if (psrc->private_data == NULL)
 		return SRC_ERR_NO_PRIVATE ;