[PATCH 02/10] tests: Fix potential out-of-bound access violation in svolume cpu-test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Meerwald <p.meerwald@xxxxxxxxxxxxxxxxxx>

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 at bct-electronic.com>
---
 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 29e4770..f312edb 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.7.9.5



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux