Blame SOURCES/0001-tests-Fix-potential-out-of-bound-access-violation-in.patch

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