Formats: reject overlapping texture depth slices #351
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!351
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/351/head"
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?
@pedrofort on GitHub · 2026-11-24 02:30 UTC · original
<head></head>pedrofort:fix-texture-depth-pitch→main· +86 −3 · 1 files · 1 commits · merged 2026-11-25 00:19 UTCProblem
Layout::walk()validates row pitch and total buffer size but does not ensure that the depth pitch separates individual slices of a 3D texture.Both
tile()anddetile()can therefore accept overlapping linear depth slices without reporting an error.Fix
Calculate the minimum occupied byte span of a depth slice using checked arithmetic.
Reject insufficient depth pitches when copying multiple slices.
Preserve valid tightly packed and padded layouts.
Preserve the existing overflow checks.
Verification
Apple M5, macOS arm64, Rust 1.98.1, base commit
Test | Before | After -- | -- | -- Overlapping detile slices | FAIL | PASS Overlapping tile slices | FAIL | PASS Exact and padded slice pitches | PASS | PASS Full formats suite | — | 23 passed, 0 failed, 3 ignoredd2a4bae.Tests cover both linear and 4 KiB standard tiled layouts and verify that rejected copies leave destination buffers unchanged.
Clippy: clean.
Asset policy: 151 files OK.
All tests use synthetic data. No game assets were used.
AI-assisted implementation and test preparation (ChatGPT), with results verified locally on Apple Silicon.
@CesarLopesO on GitHub · 2026-11-24 02:48 UTC · original
Independent validation — Debian 13 (Trixie)
I tested the current PR head
93a24b7locally on Debian 13.Results
cargo test --locked -p victory-formats --lib texture::tests::depth_pitch_— 3 passed, 0 failed.cargo test --locked -p victory-formats— 23 passed, 0 failed, 3 ignored.cargo clippy --locked -p victory-formats --all-targets -- -D warnings— passed with no warnings.cargo xtask policy— passed (151 files).git diff --check— passed; working tree clean.The focused tests cover overlapping depth pitches in both
tile()anddetile(), plus exact and padded slice pitches. The fullvictory-formatssuite also passes on Linux.I did not run the full workspace test suite as part of this validation.
No game files or game data were used.
Thanks for the fix!