mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
Vulkan: Avoid undefined behaviour with adversarial debug label (#6257)
This commit is contained in:
parent
f3cbd6ce54
commit
c2e0ad293f
@ -111,6 +111,10 @@ By @bradwerth [#6216](https://github.com/gfx-rs/wgpu/pull/6216).
|
||||
|
||||
- Fix GL debug message callbacks not being properly cleaned up (causing UB). By @Imberflur in [#6114](https://github.com/gfx-rs/wgpu/pull/6114)
|
||||
|
||||
#### Vulkan
|
||||
|
||||
- Vulkan debug labels assumed no interior nul byte. By @DJMcNab in [#6257](https://github.com/gfx-rs/wgpu/pull/6257)
|
||||
|
||||
### Changes
|
||||
|
||||
- `wgpu_hal::gles::Adapter::new_external` now requires the context to be current when dropping the adapter and related objects. By @Imberflur in [#6114](https://github.com/gfx-rs/wgpu/pull/6114).
|
||||
|
@ -15,6 +15,13 @@ use std::{
|
||||
};
|
||||
|
||||
impl super::DeviceShared {
|
||||
/// Set the name of `object` to `name`.
|
||||
///
|
||||
/// If `name` contains an interior null byte, then the name set will be truncated to that byte.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// It must be valid to set `object`'s debug name
|
||||
pub(super) unsafe fn set_object_name(&self, object: impl vk::Handle, name: &str) {
|
||||
let Some(extension) = self.extension_fns.debug_utils.as_ref() else {
|
||||
return;
|
||||
@ -44,7 +51,7 @@ impl super::DeviceShared {
|
||||
&buffer_vec
|
||||
};
|
||||
|
||||
let name = unsafe { CStr::from_bytes_with_nul_unchecked(name_bytes) };
|
||||
let name = CStr::from_bytes_until_nul(name_bytes).expect("We have added a null byte");
|
||||
|
||||
let _result = unsafe {
|
||||
extension.set_debug_utils_object_name(
|
||||
|
Loading…
Reference in New Issue
Block a user