-
Notifications
You must be signed in to change notification settings - Fork 956
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vulkan: Don't use pointer to dropped PhysicalDeviceDriverProperties.
Detected by ASAN, but seems impossible to exploit. Since `ash::vk::definitions::PhysicalDeviceDriverProperties` is `Copy`, the statement if let Some(driver) = phd_capabilities.driver { ... } actually makes `driver` a local copy of the struct. The code uses `as_ptr` to create a pointer to the `driver_name` field of this local copy, and then tries to use that pointer outside the `if let`, when the local copy has gone out of scope. This is UB. Taking a reference to the properties struct is correct and more efficient.
- Loading branch information
Showing
2 changed files
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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