clamp emulated property copies to the caller-allocated count#1939
Merged
Conversation
The *2KHR emulation terminators size a temporary array and the caller's output array from the input count, but bound the copy loop by the count the legacy ICD entrypoint writes back. A driver reporting more entries than the caller allocated then copies past both arrays. Snapshot the allocated count before the call and clamp each copy, matching the existing clamp in vkEnumerateDeviceExtensionProperties.
|
Author aizu-m not on autobuild list. Waiting for curator authorization before starting CI build. |
1 similar comment
|
Author aizu-m not on autobuild list. Waiting for curator authorization before starting CI build. |
|
CI Vulkan-Loader build queued with queue ID 11355. |
|
CI Vulkan-Loader build # 3570 running. |
|
CI Vulkan-Loader build # 3570 passed. |
charles-lunarg
approved these changes
Jun 19, 2026
charles-lunarg
left a comment
Collaborator
There was a problem hiding this comment.
Good defensive check since while we would like the count to be the same as from the first call, we can't guarantee that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 2-variant emulation terminators have a count-handling mismatch:
Noticed this reading over the emulation paths after the sparse-format size fix. The scratch array and the caller's output array are both sized from the count the caller passed in, yet the copy loop is bound by the count the legacy entrypoint writes back into the count pointer. A driver that reports more entries than the caller's array holds then walks past the stack scratch buffer and the caller's array.
The non-emulated path already guards this.
vkEnumerateDeviceExtensionPropertiescopiesmin(*pPropertyCount, count)and stops at the caller's capacity. These emulation terminators just missed the same clamp.Fix snapshots the allocated count before the call and bounds each copy to it. Same shape at all six sites: queue family, sparse image format, surface formats, display properties, display plane properties, display mode properties.