Guard texture and XMA offsets against overflow #50

Manually merged
github merged 2 commits from gh-pr/50/head into gh-pr/50/base 2026-11-26 03:48:09 +00:00
Owner

@⁠Vanthys on GitHub · 2026-11-23 23:47 UTC · original
Vanthys:fix/format-offset-overflow → main · +48 −2 · 2 files · 2 commits · merged 2026-11-24 00:34 UTC

Use checked arithmetic for texture copy pitches and XMA packet offsets. Add synthetic regression tests for overflowing row and depth pitches, an out-of-range packet index, and a truncated packet header. Make the saved-stream XMA test fail when its fixture directory is empty.

Verified with stable rustc: 20 format tests passed. The three external-fixture tests were skipped in the normal run. A separate run confirmed that the saved-stream test rejects an empty directory.

**@⁠Vanthys** on GitHub · 2026-11-23 23:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/50) `Vanthys:fix/format-offset-overflow` → `main` · +48 −2 · 2 files · 2 commits · merged 2026-11-24 00:34 UTC Use checked arithmetic for texture copy pitches and XMA packet offsets. Add synthetic regression tests for overflowing row and depth pitches, an out-of-range packet index, and a truncated packet header. Make the saved-stream XMA test fail when its fixture directory is empty. Verified with stable `rustc`: 20 format tests passed. The three external-fixture tests were skipped in the normal run. A separate run confirmed that the saved-stream test rejects an empty directory.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:48:08 +00:00
github manually merged commit 4cca76795f into gh-pr/50/base 2026-11-26 03:48:09 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-23 23:51 UTC · original

Tested 4cca767 stacked on #39 on Arch Linux x86_64, rustc 1.98.1: pass.

  • main alone does not build on Linux (E0425 in victory-gpu), so the check uses #39 as the base; the merge is clean.
  • cargo test --workspace: 156 passed, 0 failed, 3 ignored.
  • The three new tests run and pass: texture_copies_reject_overflowing_pitches, volume_copy_rejects_overflowing_depth_pitch and packet_rejects_out_of_range_indices_and_partial_headers. No game data used.

AI-assisted (DeepSeek V4.1 Flash coding agent).

**@⁠DaviTostes** on GitHub · 2026-11-23 23:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/50#issuecomment-7117442902) Tested `4cca767` stacked on **#39** on **Arch Linux x86_64, rustc 1.98.1**: **pass**. - `main` alone does not build on Linux (E0425 in `victory-gpu`), so the check uses #39 as the base; the merge is clean. - `cargo test --workspace`: **156 passed, 0 failed, 3 ignored**. - The three new tests run and pass: `texture_copies_reject_overflowing_pitches`, `volume_copy_rejects_overflowing_depth_pitch` and `packet_rejects_out_of_range_indices_and_partial_headers`. No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
Author
Owner

@⁠lordon1a on GitHub · 2026-11-24 00:19 UTC · original

Verified 4cca76795 on Windows 11 (x86_64-pc-windows-gnullvm, rustc 1.100.0, applied cleanly to main@35b054ec0): pass.

  • cargo xtask policy: 150 files ok
  • cargo test -p victory-formats: 20 passed, 0 failed, 3 ignored (+3 new overflow guard tests in texture.rs / xma.rs).

AI-assisted.

**@⁠lordon1a** on GitHub · 2026-11-24 00:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/50#issuecomment-7117956898) Verified `4cca76795` on Windows 11 (`x86_64-pc-windows-gnullvm`, `rustc 1.100.0`, applied cleanly to `main@35b054ec0`): **pass**. - `cargo xtask policy`: 150 files ok - `cargo test -p victory-formats`: **20 passed, 0 failed, 3 ignored** (+3 new overflow guard tests in `texture.rs` / `xma.rs`). AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!50
No description provided.