shithub: libsamplerate

Download patch

ref: 67b53baa8913efadd8663f7317f565d6452c402e
parent: 7a200942cedf07c18130957a4a27a889d88bc0e5
author: evpobr <evpobr@gmail.com>
date: Tue Nov 3 16:05:05 EST 2020

Avoid arithmetic overflow

--- a/src/src_linear.c
+++ b/src/src_linear.c
@@ -80,7 +80,7 @@
 
 		for (ch = 0 ; ch < state->channels ; ch++)
 		{	data->data_out [priv->out_gen] = (float) (priv->last_value [ch] + input_index *
-										(data->data_in [ch] - priv->last_value [ch])) ;
+										((double) data->data_in [ch] - priv->last_value [ch])) ;
 			priv->out_gen ++ ;
 			} ;
 
@@ -105,7 +105,7 @@
 
 		for (ch = 0 ; ch < state->channels ; ch++)
 		{	data->data_out [priv->out_gen] = (float) (data->data_in [priv->in_used - state->channels + ch] + input_index *
-						(data->data_in [priv->in_used + ch] - data->data_in [priv->in_used - state->channels + ch])) ;
+						((double) data->data_in [priv->in_used + ch] - data->data_in [priv->in_used - state->channels + ch])) ;
 			priv->out_gen ++ ;
 			} ;