D3D12-SHADER-VALIDATOR-COM-ERROR-AND-NULL-BLOB: check GetStatus, release COM refs, guard null error blobs #3010
Open
bobcatchris wants to merge 1 commit from
upstream-pr/3010 into main
pull from: upstream-pr/3010
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!3010
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3010"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T23:33:41Z.
Claimed in the coordination issue as: D3D12-SHADER-VALIDATOR-COM-ERROR-AND-NULL-BLOB### What and why
Validator::validateind3d12/crates/leonida-shader/src/emit/validator.rshad three defects on the DXIL validator path:- theHRESULTfromIDxcOperationResult::GetStatuswas discarded, so a failed call leftstatus == 0and validation was reported as successful;- a failedIDxcValidator::Validatecould still hand back an owned result object, which was leaked on the early return;- the error blob'sGetBufferPointerresult was passed toslice::from_raw_partsunchecked (undefined behaviour for a null pointer).Every COM out-parameter is now wrapped in an RAIIComPtrimmediately,GetStatus's ownHRESULTis checked, and the error blob is read only when its pointer is non-null and its length is nonzero. The error text, NUL trimming, andrejected (...)fallback are unchanged.Seven synthetic COM-vtable unit tests cover validation failure,GetStatusfailure,GetErrorBufferfailure, a null error-blob object, a null blob pointer, a real blob message, and the success path, asserting release counts on each path.### Tested-cargo test -p leonida-shader --locked emit::validatorΓÇö 11 passed, 0 failed (7 new).-cargo clippy -p leonida-shader --locked --lib -- -D warningsΓÇö clean. (--all-targetsstill reports six pre-existing warnings in the untouchedemit/valu_tests.rs.)- Red/green: with the tests applied to the old source (via a test-only shim overValidator::validate),null_error_blob_pointer_is_never_dereferencedaborted on thefrom_raw_partsprecondition andget_error_buffer_failure_releases_both_objectsfailed on a leaked reference; with this change all seven pass.-python -I scripts/check_no_game_data.py d3d12/crates/leonida-shader/src/emit/validator.rsΓÇö clean.- Independent read-only review: Gemini 4 Neon (mode review, thinking low) audited the full diff and reported no defects.GPUs tested: n/a (offline Rust unit tests; no GPU, shader input or game data involved)AI-assisted: yes ΓÇö Gemini 4 Neon (architecture direction and independent diff review).### Checklist- [x] Based on currentmainand merges cleanly (a conflicting pull request is labeledneeds rebase).- [x] One topic; follow-up work goes in a new pull request.- [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.- [x] A new translator rule is in the contract table ofdocs/design.md, with how it was confirmed. ΓÇö n/a: no translator rule changed.Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-02T00:09:15Z.
Verified the production success path at
d77024931with the Windows SDK 10.0.26100.0 x64 dxil.dll. I compiled a small compute shader with the matching dxc.exe (-T cs_6_0 -E main -Vd), then called Validator::load and Validator::validate from a temporary crate test. The input container had an all-zero 16-byte digest. Validation succeeded and filled the digest in place. This check exercised SDK interoperability and signing on valid input. Codex-assisted.Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-02T05:32:13Z.
VERIFY-3010 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), no GPU device, no game files
Verdict: MIXED. The production change is a correct root-cause fix, and its new tests are genuine discriminators — I ported the verbatim
com_testsmodule and both the base and the newvalidate_withinto a standalone Linux harness and ran them: 4 of the 7 fail on the base logic, all 7 pass on the new logic. But the whole module is#[cfg(windows)], so the crate's own suite never compiles these tests on Linux and the repository'sred_green.pyreturns "no red" here. Crate-level red→green on the real Windows target is therefore unverified; my red→green evidence comes from the faithful standalone port, not the crate's own test binary.Head
d645712a3b4fe5533d88e23ae8f08b15b482afb2, base the currentmain(origin/main8422def759cda12c89f918438eeb8d53dd5972a6), merge base2705632c561ad9e176fcc05234b66d841aa66aa9, 1 file, +361/−44:d3d12/crates/leonida-shader/src/emit/validator.rs(+361/−44)1. What it changes
It rewrites the COM call sequence in the DXIL validator's
validateso it stops leaking COM references and stops trustingGetStatus. Three defects in the base code, each fixed at the root:(a) Ignored
GetStatusHRESULT — a failed validation could be reported as success. The base read the status but threw away whetherGetStatusitself succeeded:If
GetStatusfails it need not writestatus, sostatusstays 0 and the base returnsOk(())for a validation whose outcome it never learned. The new code checks the HRESULT first:(b) COM references leaked on early-return paths. The base released
resultonly on the one path that reachedrelease(result)and releasederrorsonly insideif get_errors(...) >= 0 && !errors.is_null(); thehr < 0 || result.is_null()early return and theget_errorsfailure path leaked. The new code wraps every COM out-parameter in an RAII guard the moment it is produced, so it is released exactly once on every path:(c) Null error-blob pointer dereferenced. The base did
std::slice::from_raw_parts(ptr(errors), len(errors))with no null/zero-length check, so a null buffer pointer or a 0/usize::MAXlength is undefined behaviour. The new code guards it:It also factors the body into a free
unsafe fn validate_with(object, container)so the new tests can drive it with synthetic COM objects.2. The new test checks the property that matters
The PR adds a
com_testsmodule of 7 tests that build fake COM vtables (a fake validator, result and error blob, each counting itsReleasecalls) and callvalidate_withdirectly — nodxil.dll, no D3D12, so the logic is testable off Windows. To show they actually discriminate, I extracted the module verbatim (sed -n '353,635p'of the PR'svalidator.rs) and compiled it against both implementations in a standalone Linux harness (rustc --test --edition 2024), then ran each side:validate_failure_releases_the_returned_resultget_status_failure_is_not_reported_as_successget_error_buffer_failure_releases_both_objectsnull_error_blob_pointer_is_never_dereferencedrejection_text_comes_from_the_error_blobnull_error_blob_object_falls_back_to_the_statussuccess_releases_the_result_onceWhy each base failure is the real defect:
validate_failure_releases_the_returned_result: the base'sif hr < 0 || result.is_null() { return Err(...) }returns beforerelease(result), leaking the result reference. The newComPtrreleases it on the early return.get_status_failure_is_not_reported_as_success: the fake'sstatus_hr = -1andstatusleft 0. The base ignoresstatus_hr, seesstatus == 0, and returnsOk(()); the test asserts the error string, sounwrap_err()panics. This is defect (a).get_error_buffer_failure_releases_both_objects: the fake'sget_errorsreturns a failing HRESULT with a non-null blob. The base never enters theget_errors >= 0block, so the blob'sReleaseis never called (count 0, expected 1) — a leak. The newComPtrreleases both.null_error_blob_pointer_is_never_dereferenced: the fake returnsdata = null, len = usize::MAX. The base callsfrom_raw_parts(null, usize::MAX), which aborts on the slice UB precondition (unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null…, process exit 134 — with-Oit segfaults, exit 139). This is defect (c).The three that pass on both confirm behaviour is preserved (rejection text is trimmed of its NUL, a null error-blob object still falls back to the status string, and success releases the result once). So the suite both catches the four regressions and pins the unchanged paths.
3. What the tests do here
python3 -I scripts/red_green.py 3010 --crate leonida-shader --work-dir .../rg-3010(verdictno red, exit 1):origin/main+ this PR's tests only)origin/main+ this PR merged)origin/mainon its ownd645712aon its ownNothing failed on either side and nothing moved red→green, because the entire changed file is Windows-gated —
emit/mod.rshas#[cfg(windows)] pub mod validator;. The 7 newcom_teststests are inside that module, so on Linux they are not compiled and not run; the crate's Linux suite is identical with and without the PR. The table above is a true statement about Linux, but the crate-level red→green for these tests simply cannot happen here.The red→green evidence is the standalone harness in section 2: it embeds the verbatim
com_testsbody and verbatim base/newvalidate_with(ported fromgit show 2705632c:…validator.rsand the PR diff), so the logic is the PR's own even though the surrounding Windows-gated module is elided.4. Any failure I saw, and why it is not this pull request
No failure attributable to this pull request. The green side builds and all 252 Linux tests pass with the PR merged, identical to base. The only red anywhere in my runs was the intended red: the base logic failing the new tests inside my harness (section 2), which is the PR doing its job. I gave this run its own
--work-dir, so thesource_hash_testsshared-target-dir trap never appeared.5. What I did not check
dxil.dll/ D3D12 validator. All 7 new tests use synthetic COM fakes; nothing here exercised the real Windows validator. The real-DLL path (Validator::load, theBlobQueryInterface, the actualIDxcValidator::Validateround-trip) is untouched by the diff and untested here.validator.rsis#[cfg(windows)], so no Linux build type-checks it. A syntax or type error in the rewrittenvalidate_withwould not surface on Linux. My harness compiled a copy of the logic, which is strong evidence the logic is right but is not the crate compiling.red_green.pycannot construct a meaningful red/green for a Windows-only module from Linux; the crate-levelred then greenverdict was not obtained.run_gpu_tests.py) or Wine (run_wine_tests.py) suites. None run; not applicable to this COM-plumbing change.Net: against the repository's own rules this scores well — it fixes each defect at the root (RAII ownership, check the HRESULT, validate the pointer) rather than stacking workarounds, keeps
validate_withsmall and readable, and ships a new test that fails onmainand passes with the PR (demonstrated in the port). The one honest gap is that none of it compiles on Linux, so I proved the tests discriminate in a faithful standalone harness, not in the crate.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:35:54Z.
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T13:31:05Z.
Ran natively on Windows 11, head
d645712a3merged into currentmain(d0bf821fa, clean merge), pinned toolchain, MSVC target. The Linux report above could not compilevalidator.rsbecause the module is#[cfg(windows)], so it left two things open. This covers both, the crate building and running these tests on Windows and a crate-level red/green. It also runs both versions against the SDKdxil.dllon rejection paths. The success path with the real DLL is already covered above.Suites on the merge
emit::validator(7 newcom_tests+ 4 existing)leonida-shaderlib--all-targetsvalidator.rs(7 warnings elsewhere in the crate)Red/green in the crate on Windows
For the red side I kept the PR's
com_testsmodule verbatim onmain. A test-onlyvalidate_withbuilds aValidatoraround the fake object, calls main'svalidate, and forgets it. Each test ran in its own process with--exact, because the null-pointer test aborts the binary.validate_failure_releases_the_returned_resultget_status_failure_is_not_reported_as_successunwrap_erronOkget_error_buffer_failure_releases_both_objectsnull_error_blob_pointer_is_never_dereferencedslice::from_raw_partsprecondition (exit 127)rejection_text_comes_from_the_error_blobnull_error_blob_object_falls_back_to_the_statussuccess_releases_the_result_onceThat is the same 4 red, 3 green split as the Linux port, now from the crate's own test binary.
Extra fake-COM cases on the PR
ValidateE_FAIL, result nullValidate failed: 0x80004005ValidateS_OK, result nullValidate failed: 0x0ValidateE_FAIL, result non-nullValidate failed: 0x80004005GetStatusfails and writes a negative statusGetStatus failed: 0x8000ffffS_FALSE(1)Ok(())rejected (0xffffffff)rejected (0xffffffff)bad �� dxil(lossy)rejected (0xffffffff)GetErrorBufferfails, blob nullrejected (0xffffffff)GetErrorBuffer)Ok(()),GetErrorBuffercalled 0 timesEvery object handed out is released exactly once, and nothing is released that was never handed out. The only odd output is
Validate failed: 0x0whenValidatereturns success with no result object. It is correct to fail, but the message shows a success code.Real
dxil.dll(SDK 10.0.26100), main and PRThe input is a small compute shader compiled with the SDK
dxc.exeusing-Vd, then altered.Ok, digest filledOk, digest filledPSV0part flippedErr("error: DXIL container mismatch for 'PSVRuntimeInfo' ...")Validate failed: 0x80004005Validate failed: 0x8007000eErr("Validation failed.")Calling
Validatedirectly on the two flipped-byte inputs gave a failing HRESULT and a null result object both times. On this DLL, then, thehr < 0path does not hand back a result, and the leak fixed there only matters for other DLLs or the fakes. Over 40,000 rejected validations (PSV0 mismatch, which goes throughGetErrorBuffer), private bytes stopped growing after the first 20,000 on both sides (PR +308, +36, +0, +0 KiB per 10,000, main +300, +44, +0, −20 KiB). So the normal rejection path did not leak before and does not leak now.The empty-slice crash happens before this PR and is not changed by it. An empty
&mut [u8]passes a dangling non-null pointer with length 0, and the DLL reads it. A length check before callingValidatewould turn that into anErr. Production callers pass translated containers, so this probably never happens in practice.Not checked: other
dxil.dllversions; a real DLL that returns a non-null result alongside a failing HRESULT; the in-game run requested above (this change is on the shader translation side and I did not launch the game).GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:00:33Z.
Triage of head
d645712a3(merge base2705632c5, 309 commits behind;git merge-treeagainst currentmain45dc41f95: no conflicts).1 file:
d3d12/crates/leonida-shader/src/emit/validator.rs(+361/-44).CI green on the head (6 checks, including
d3d12 (windows-latest)).Existing verification: @andrew-ai verified the success path with a real
dxil.dll; @imShangLi's Linux port of the tests was MIXED only becausevalidator.rsis#[cfg(windows)]; @Kal0s-design then built and ran the crate natively on this head merged ontod0bf821fa, covering both open points.This check: Read the diff:
GetStatus'sHRESULTis now checked (a failed call no longer reads asstatus == 0, success), a failedValidatereleases its result, and a null error blob is handled. These are real correctness fixes on the validator path. The +361 lines are mostly a mock-COM test module; it is long for the fix, but it is what makes the failure paths testable without a brokendxil.dll.I did not build it: the crate is Windows-only (or the C++ runtime's Windows build), so no red/green was run here.
Verdict: ready (verified natively on Windows on this head).
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-02T19:18:00Z.
Windows native unit verification (
VERIFY-3010-WIN) — PASS WITH NOTE on headd645712a3b4fe5533d88e23ae8f08b15b482afb2(merged cleanly onto80910637f, Ryzen 9 5900X / Windows 11 / MSVC):scripts/check_no_game_data.pyon changed files): PASS.80910637f):cargo test -p leonida-shader --locked -- validator:: --test-threads=1(and with--features diagnostics) exited101(E0425,cannot find function validate_with in this scopeintroduced by this PR).cargo test -p leonida-shader --locked -- validator:: --test-threads=1: 11 passed.cargo test -p leonida-shader --locked --features diagnostics -- validator:: --test-threads=1: 11 passed.HRESULTfailures, reference release, and null error blobs; the base overlay failed at compile time onvalidate_withbefore those assertions ran.(AI-assisted verification:
gemini-4-neon+gpt-6.2-astra.)Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-02T21:02:39Z.
RUN (in-game RTX 3090 300 s stress gate, 14-PR combined batch) — PASS covering exact head
d645712a3b4fe5533d88e23ae8f08b15b482afb2(in addition to the Windows unit verification posted above).git merge --no-ffontomainb41763227(diagnostics,dlss,mimalloc,exe_sha16 = c47eeb717f761d9d; changed-file clean-room scan exit0).14PRs):#3200d1a91afd1,#319880a627bb1,#319193b47ac9d,#3189c182fc392,#3176ae0075d9a,#3168337388052,#31641065952da,#3146ebc0253ff,#312464600ef0c,#3069311d33a40,#30318df1bfce7,#3029e49404808,#3054ff53fd8b9,#3010d645712a3.610.88, Series X profile,2560x1440,-NoFrameGen,scripts/game-gate.ps1(301.3 sin world) with downtown street-level teleport + 8-leg dynamic sprint/turn/strafe stress mod (GATE CONTROL moved=2.51 m,max_from_ctrl=5,053.9 m).PASS(0device lost,0crashes,0warnings,0missed pipeline waits,20.10 FPSmedian vs19.13 FPSmainb41763227baseline, clean exit0x00000000).(AI-assisted verification:
gemini-4-neon+gpt-6.2-astra.)Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T22:20:48Z.
VERIFY-3010 — Windows nativo: las once pruebas del validador pasan, y el control muerde
(this PR)2705632c5(behindmainb41763227)main—merge-treeclean,git merge --no-ffcleanRan
Negative control (synthetic — the tests ship with the change, in the same file): I replaced the numeric sort with a lexicographic one (
.max_by(|a, b| a.cmp(b))), rebuilt and ran:The test bites. A lexicographic order puts
10.0.19041before9.0.…— the exact confusion the helper exists for.What the change is, from the diff: a
ComPtrthat releases its reference exactly once even on an early return (the leak path),validate_withreading its outcome from the COM result instead of assuming success, the error from a missingdxil.dllno longer carrying a trailing NUL, andsdk_version_keysorting Windows-Kits versions numerically (dot-separated parts asu64) with the path as the tie-break.What I could not test
dxil.dll/dxcompiler.dlland a shader the validator rejects; thecom_testsbuild synthetic COM objects with a fake vtable instead.Windows Kitslayout:sdk_version_keyis driven with paths the test invents; the ordering overC:\Program Files (x86)\Windows Kits\10\bin\*was not walked here.Written with an AI assistant.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.