From 9ef510f6b629b1dc176d23ab9f9916ef292195bf Mon Sep 17 00:00:00 2001 From: "Levy A." Date: Sun, 12 Jan 2025 17:41:56 -0300 Subject: [PATCH 1/2] fix: string passed to the callback must be null terminated --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 872918ad..ddba0296 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2696,7 +2696,7 @@ pub unsafe extern "C" fn wgpuInstanceRequestAdapter( callback( native::WGPURequestAdapterStatus_Error, std::ptr::null_mut(), - "unsupported backend type: d3d11".as_ptr() as _, + "unsupported backend type: d3d11\0".as_ptr() as _, userdata, ); return; From f26e03933f8a620be8729187aeff2f7256c9e506 Mon Sep 17 00:00:00 2001 From: "Levy A." <140299755+levydsa@users.noreply.github.com> Date: Tue, 14 Jan 2025 04:01:51 -0300 Subject: [PATCH 2/2] refactor: use c string literal Co-authored-by: Connor Fitzgerald --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ddba0296..d8eb83a6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2696,7 +2696,7 @@ pub unsafe extern "C" fn wgpuInstanceRequestAdapter( callback( native::WGPURequestAdapterStatus_Error, std::ptr::null_mut(), - "unsupported backend type: d3d11\0".as_ptr() as _, + c"unsupported backend type: d3d11".as_ptr() as _, userdata, ); return;