Skip to content

Commit

Permalink
Avoid OOB access in backend_tests for platforms with no devices
Browse files Browse the repository at this point in the history
  • Loading branch information
fknorr committed Aug 29, 2023
1 parent 9d69668 commit 0a282f5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions test/backend_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct host_or_device {

std::pair<host_or_device, host_or_device> select_source_and_target(const copy_test_type test_type, const sycl::platform& platform) {
const auto devices = platform.get_devices();
if(devices.empty()) { throw std::runtime_error(fmt::format("Platform {} has no devices", platform.get_info<sycl::info::platform::name>())); }
switch(test_type) {
case copy_test_type::intra_device: {
return std::pair{host_or_device{sycl::queue{devices[0]}}, host_or_device{sycl::queue{devices[0]}}};
Expand Down

0 comments on commit 0a282f5

Please sign in to comment.