diff --git a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_get_info.cpp b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_get_info.cpp index 1932ef5469..e00ca293d6 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_get_info.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_get_info.cpp @@ -218,18 +218,22 @@ struct GetCommandBufferInfo : public BasicCommandBufferTest cl_int RunPropArrayInfoTest() { - std::vector properties; - properties.resize(number_of_properties); - - cl_int error = clGetCommandBufferInfoKHR( - command_buffer, CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR, - number_of_properties * sizeof(cl_command_buffer_properties_khr) - 1, - properties.data(), nullptr); - - test_failure_error_ret(error, CL_INVALID_VALUE, - "clGetCommandBufferInfoKHR should return " - "CL_INVALID_VALUE", - TEST_FAIL); + if (0 != number_of_properties) + { + std::vector properties; + properties.resize(number_of_properties); + + cl_int error = clGetCommandBufferInfoKHR( + command_buffer, CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR, + number_of_properties * sizeof(cl_command_buffer_properties_khr) + - 1, + properties.data(), nullptr); + + test_failure_error_ret(error, CL_INVALID_VALUE, + "clGetCommandBufferInfoKHR should return " + "CL_INVALID_VALUE", + TEST_FAIL); + } return TEST_PASS; }