summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Meerwald <p.meerwald@bct-electronic.com>2013-01-30 11:03:57 +0100
committerWim Taymans <wtaymans@redhat.com>2014-11-20 15:29:35 +0100
commit1d1a26eec5020a7029fdd2e359c3922a6d9a34e8 (patch)
tree316cafe92fc8b6a83dad41565cf848b2265b8272
parent8cf7824ec65be23d8041fa7ecc6c09f1e800a1cb (diff)
tests: Fix potential out-of-bound access violation in svolume cpu-testrhel-7.1
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 <p.meerwald@bct-electronic.com>
-rw-r--r--src/tests/cpu-test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tests/cpu-test.c b/src/tests/cpu-test.c
index 8e196e5bf..98a6e92e1 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);