feat: FFI null handle guards + go vet cleanup v0.4.0#12
Merged
Conversation
- Add nil/zero-handle guards on all public FFI methods to prevent SIGSEGV - Add ptrFromUintptr helper — eliminates all 15 go vet unsafe.Pointer warnings - Add WGPU_NATIVE_PATH env var for custom library path override - Change loadLibrary to return (Library, error) with descriptive messages - Windows: eager DLL loading via dll.Load() for early error detection - Add 85 null guard tests (CI-safe, no GPU required) - Update CI test filters to include NullGuard tests
99ad582 to
ad0af04
Compare
- Download wgpu-native v27.0.4.0 for all platforms (Linux, macOS, Windows) - NullGuard tests now run with real library in CI - Remove go vet -unsafeptr=false (all warnings fixed via ptrFromUintptr) - Add skipIfNoLibrary fallback for environments without wgpu-native
ad0af04 to
ebfc523
Compare
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.
Summary
Comprehensive FFI hardening for v0.4.0 — prevents SIGSEGV crashes when passing nil/released objects to wgpu-native.
ptrFromUintptrhelper — eliminates all 15 pre-existinggo vetunsafe.Pointer warningsWGPU_NATIVE_PATHenv var — override library path for custom wgpu-native locationsloadLibraryreturns(Library, error), eager DLL loading on WindowsTestNullGuard_*) — CI-safe, no GPU requiredCloses #11
Test plan
go build ./...— cleango vet ./...— 0 warnings (was 15)golangci-lint run ./wgpu/— 0 issuesgofmt -l ./wgpu/— clean