Skip to content

Commit

Permalink
Fix UB bug in extensions/cl_khr_command_buffer/command_buffer_test_ba…
Browse files Browse the repository at this point in the history
…rrier.cpp

BarrierWithWaitListKHR::Run in command_buffer_test_barrier.cpp contains a
"check second enqueue" which tries to zero out the cl_mems before enqueueing
the command buffer again. However, the zeroing commands are enqueued to the
in-order queue, while the command buffer to the out-of-order queue. Since there
is no implicit or explicit sync, this is undefined behaviour.
  • Loading branch information
franz committed Nov 13, 2023
1 parent ec16d0e commit 62ec22a
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ struct BarrierWithWaitListKHR : public BasicCommandBufferTest
0, data_size(), 0, nullptr, nullptr);
test_error(error, "clEnqueueFillBufferKHR failed");

error = clFinish(queue);
test_error(error, "clFinish");

error = clEnqueueCommandBufferKHR(
0, nullptr, out_of_order_command_buffer, 0, nullptr, &event);
test_error(error, "clEnqueueCommandBufferKHR failed");
Expand Down

0 comments on commit 62ec22a

Please sign in to comment.