Repository navigation
Conversation
Dukestar69
approved these changes
Nov 26, 2026
Dukestar69
left a comment
There was a problem hiding this comment.
LGTM — verified on Windows against origin/main (63bcca4).
- Validating
array,dir,dir.index, andblockfor null and usingchecked_sub/checked_addfor the TLS block length cleanly guardsOwnTls::saveandOwnTls::restoreagainst invalid TLS pointers or overflowing bounds. cargo test -p victory-loader --lib threads:: -- --test-threads=1: 5 passed, 0 failed (includingown_tls_save_rejects_null_pointers,own_tls_save_rejects_invalid_bounds_and_lengths, andown_tls_save_and_restore_preserves_state).cargo clippy -p victory-loader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.
Tracked in #1633.
Problem
In
crates/victory-loader/src/threads.rs,OwnTls::save()dereferencedTEB.ThreadLocalStoragePointer(gs:[0x58]),(*dir).index, and*array.add(slot)without null checks, and computed the TLS block length with unchecked arithmetic ((*dir).end - (*dir).start + (*dir).zero_fill as usize).Changes
save_from(array, dir) -> Option<OwnTls>helper that validates non-nullarray,dir,(*dir).index, and resolvedblock, computes the block length withchecked_sub/checked_add, and returnsNonefor zero-length or invalid bounds.OwnTls::save()to delegate tosave_fromandon_threadto only restore whenSome(saved)is returned.OwnTls::restore()against nullblockor emptysaved.threads::testscovering null pointers, invalid bounds/overflow/zero length, and synthetic TLS save/restore round-trip.Verification
cargo test -p victory-loader(38 unit + 4 integration tests passed)cargo clippy -p victory-loader --all-targets(0 warnings)AI-assisted with Gemini.