Skip to content

Commit

Permalink
relationals: fix out of bounds accesses in shuffle test
Browse files Browse the repository at this point in the history
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 <sven.vanhaastregt@arm.com>
  • Loading branch information
svenvh committed May 3, 2024
1 parent 46255db commit e98f5f4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test_conformance/relationals/test_shuffles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit e98f5f4

Please sign in to comment.