GPU: clamp Staging::detile slices and harden page readability checks #165
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/165"
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 fxceless/victory-fork. Originally posted by HailLucifer666 on 2026-11-24T22:06:10Z.
Problem
Staging::detile()built a mutable slice ofpitch * rows * deptheven whenGetCopyableFootprintsomits trailing row-pitch padding on the final row, exceedingself.bytes(UB).readable()usedat.saturating_add(len - 1), which saturates tousize::MAXon address overflow and loops across the 64-bit address space instead of rejecting the range.committed_by_query()used uncheckedp + len, and bothVirtualQuerypaths (committed_by_queryandmapped_bytes) countedPAGE_NOACCESSandPAGE_GUARDpages as readable committed memory.Fix
Staging::detile()slices viasubresource_len(..., self.bytes).checked_addinreadable(),committed_by_query(), andmapped_bytes().is_readable_commit()across bothVirtualQuerypaths to rejectPAGE_NOACCESSandPAGE_GUARD.Verification
subresource_lenand realVirtualAllocPAGE_NOACCESS/PAGE_GUARD/PAGE_READWRITE+usize::MAXoverflow cases.cargo clippy --workspace --all-targets --locked -- -D warningscargo clippy --workspace --all-targets --all-features --locked -- -D warningscargo test -p victory-gpu texture:: --locked(4/4 passed)cargo test -p xtask --locked(4/4 passed)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.