sample-util: avoid stack overrun
authorWim Taymans <wim.taymans@collabora.co.uk>
Tue, 25 Aug 2009 15:40:44 +0000 (17:40 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 27 Aug 2009 08:44:52 +0000 (10:44 +0200)
The linear volume array needs enough padding when preparing the volumes for
mixing.

src/pulsecore/sample-util.c

index 6e97e5a..5fae192 100644 (file)
@@ -137,7 +137,7 @@ static void calc_linear_float_volume(float linear[], const pa_cvolume *volume) {
 
 static void calc_linear_integer_stream_volumes(pa_mix_info streams[], unsigned nstreams, const pa_cvolume *volume, const pa_sample_spec *spec) {
     unsigned k, channel;
-    float linear[PA_CHANNELS_MAX];
+    float linear[PA_CHANNELS_MAX + VOLUME_PADDING];
 
     pa_assert(streams);
     pa_assert(spec);
@@ -156,7 +156,7 @@ static void calc_linear_integer_stream_volumes(pa_mix_info streams[], unsigned n
 
 static void calc_linear_float_stream_volumes(pa_mix_info streams[], unsigned nstreams, const pa_cvolume *volume, const pa_sample_spec *spec) {
     unsigned k, channel;
-    float linear[PA_CHANNELS_MAX];
+    float linear[PA_CHANNELS_MAX + VOLUME_PADDING];
 
     pa_assert(streams);
     pa_assert(spec);