diff options
| author | Gabríel Arthúr Pétursson <gabriel@system.is> | 2018-03-21 22:44:11 +0000 |
|---|---|---|
| committer | Dave Houlton <daveh@lunarg.com> | 2018-04-04 16:16:14 -0600 |
| commit | 90605a51d8197d87f9b280d99c9da5e1627f0977 (patch) | |
| tree | 0e27ddc22fc25c5eee3231ffd0139a6f5cedf738 /layers/parameter_validation_utils.cpp | |
| parent | e86bb48e0aa57fb85865447c8d573cc724d71920 (diff) | |
| download | usermoji-90605a51d8197d87f9b280d99c9da5e1627f0977.tar.xz | |
layers: Avoid reading pointer to array when count is zero
Take for example VkSubmitInfo. It has, amongst others, two fields:
waitSemaphoreCount and pWaitSemaphores. The specification states that
if waitSemaphoreCount is zero, the application may leave pWaitSemaphores
uninitialized (in essence, that field is ignored).
The layers read that value anyway, triggering uninitialized read errors
by memory sanitization tools.
Fixes uninitialized read in QueueSubmitSemaphoresAndLayoutTracking.
Diffstat (limited to 'layers/parameter_validation_utils.cpp')
| -rw-r--r-- | layers/parameter_validation_utils.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/layers/parameter_validation_utils.cpp b/layers/parameter_validation_utils.cpp index b9adf037..ba071d8d 100644 --- a/layers/parameter_validation_utils.cpp +++ b/layers/parameter_validation_utils.cpp @@ -1599,7 +1599,7 @@ bool pv_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache report_data, "vkCreateGraphicsPipelines", ParameterName("pCreateInfos[%i].pMultisampleState->rasterizationSamples", ParameterName::IndexVector{i}), ParameterName("pCreateInfos[%i].pMultisampleState->pSampleMask", ParameterName::IndexVector{i}), - pCreateInfos[i].pMultisampleState->rasterizationSamples, pCreateInfos[i].pMultisampleState->pSampleMask, + pCreateInfos[i].pMultisampleState->rasterizationSamples, &pCreateInfos[i].pMultisampleState->pSampleMask, true, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); skip |= validate_bool32( @@ -1765,7 +1765,7 @@ bool pv_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache report_data, "vkCreateGraphicsPipelines", ParameterName("pCreateInfos[%i].pColorBlendState->attachmentCount", ParameterName::IndexVector{i}), ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments", ParameterName::IndexVector{i}), - pCreateInfos[i].pColorBlendState->attachmentCount, pCreateInfos[i].pColorBlendState->pAttachments, false, + pCreateInfos[i].pColorBlendState->attachmentCount, &pCreateInfos[i].pColorBlendState->pAttachments, false, true, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); if (pCreateInfos[i].pColorBlendState->pAttachments != NULL) { @@ -2054,7 +2054,7 @@ bool pv_vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, u // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond // validate_array() skip |= validate_array(report_data, "vkFreeDescriptorSets", "descriptorSetCount", "pDescriptorSets", descriptorSetCount, - pDescriptorSets, true, true, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); + &pDescriptorSets, true, true, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); return skip; } @@ -2238,7 +2238,7 @@ bool pv_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_ // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond // validate_array() skip |= validate_array(report_data, "vkFreeCommandBuffers", "commandBufferCount", "pCommandBuffers", commandBufferCount, - pCommandBuffers, true, true, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); + &pCommandBuffers, true, true, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); return skip; } @@ -2639,7 +2639,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDe instance_layer_data *local_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), instance_layer_data_map); bool skip = validate_array(local_data->report_data, "vkEnumerateDeviceExtensionProperties", "pPropertyCount", "pProperties", - pPropertyCount, pProperties, true, false, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_2761f401); + pPropertyCount, &pProperties, true, false, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_2761f401); if (skip) return VK_ERROR_VALIDATION_FAILED_EXT; return local_data->dispatch_table.EnumerateDeviceExtensionProperties(physicalDevice, NULL, pPropertyCount, pProperties); @@ -2742,12 +2742,12 @@ bool pv_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { skip |= validate_struct_pnext(device_data->report_data, "QueuePresentKHR", "pCreateInfo->pNext->pNext", NULL, present_regions->pNext, 0, NULL, GeneratedHeaderVersion, VALIDATION_ERROR_1121c40d); skip |= validate_array(device_data->report_data, "QueuePresentKHR", "pCreateInfo->pNext->swapchainCount", - "pCreateInfo->pNext->pRegions", present_regions->swapchainCount, present_regions->pRegions, true, - false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); + "pCreateInfo->pNext->pRegions", present_regions->swapchainCount, &present_regions->pRegions, + true, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); for (uint32_t i = 0; i < present_regions->swapchainCount; ++i) { skip |= validate_array(device_data->report_data, "QueuePresentKHR", "pCreateInfo->pNext->pRegions[].rectangleCount", "pCreateInfo->pNext->pRegions[].pRectangles", present_regions->pRegions[i].rectangleCount, - present_regions->pRegions[i].pRectangles, true, false, VALIDATION_ERROR_UNDEFINED, + &present_regions->pRegions[i].pRectangles, true, false, VALIDATION_ERROR_UNDEFINED, VALIDATION_ERROR_UNDEFINED); } } |
