From a130f3d179c100ecdc781686001f894fbd55f474 Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Tue, 4 Jun 2024 18:38:44 +0200 Subject: [PATCH] relationals: fix out of bounds accesses in shuffle test (#1961) The values in `src` are indices into an array in `get_order_string()`. Not initializing `src` resulted in out of bounds accesses there. It seems that when the out of bounds accesses happened, the result of `get_order_string()` was not actually used, so at least the test was not using random data. Fix the issue as it prevents a clean run of this test with e.g. AddressSanitizer. Signed-off-by: Sven van Haastregt --- test_conformance/relationals/test_shuffles.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test_conformance/relationals/test_shuffles.cpp b/test_conformance/relationals/test_shuffles.cpp index de67f339cc..223e29e6c2 100644 --- a/test_conformance/relationals/test_shuffles.cpp +++ b/test_conformance/relationals/test_shuffles.cpp @@ -882,7 +882,8 @@ int test_shuffle_random(cl_device_id device, cl_context context, cl_command_queu int numTests = NUM_TESTS*NUM_ITERATIONS_PER_TEST; for( int i = 0; i < numTests /*&& error == 0*/; i++ ) { - ShuffleOrder src, dst; + ShuffleOrder src{ 0 }; + ShuffleOrder dst; if( shuffleMode == kBuiltInFnMode ) { build_random_shuffle_order( dst, vecSizes[ dstIdx ], vecSizes[ srcIdx ], true, d );