From 1d1a26eec5020a7029fdd2e359c3922a6d9a34e8 Mon Sep 17 00:00:00 2001
From: Peter Meerwald
Date: Wed, 30 Jan 2013 11:03:57 +0100
Subject: [PATCH] tests: Fix potential out-of-bound access violation in svolume
cpu-test
nsamples should be forced to be a multiple of channels; do so correctly
and don't make nsamples larger than it actually is
Signed-off-by: Peter Meerwald
---
src/tests/cpu-test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/tests/cpu-test.c b/src/tests/cpu-test.c
index 8e196e5..98a6e92 100644
--- a/src/tests/cpu-test.c
+++ b/src/tests/cpu-test.c
@@ -84,8 +84,8 @@ static void run_volume_test(pa_do_volume_func_t func, pa_do_volume_func_t orig_f
samples_orig = s_orig + (8 - align);
nsamples = SAMPLES - (8 - align);
if (nsamples % channels)
- nsamples += nsamples % channels;
- size = nsamples * sizeof(*samples);
+ nsamples -= nsamples % channels;
+ size = nsamples * sizeof(int16_t);
pa_random(samples, size);
memcpy(samples_ref, samples, size);
--
1.9.3