Guard texture and XMA offsets against overflow #50

Merged
Vanthys merged 2 commits from upstream-pr/50 into main 2026-11-24 00:34:04 +00:00
Vanthys commented 2026-11-23 23:47:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Vanthys on 2026-11-23T23:47:20Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6571255671 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/50). Originally posted by [Vanthys](https://github.com/Vanthys) on 2026-11-23T23:47:20Z. --- 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.
upstream-sync closed this pull request 2026-11-24 06:51:05 +00:00
DaviTostes commented 2026-11-24 06:54:33 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-23T23:51:45Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7117442902 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/50#issuecomment-7117442902). Originally posted by [DaviTostes](https://github.com/DaviTostes) on 2026-11-23T23:51:45Z. --- 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).
lordon1a commented 2026-11-24 06:54:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by lordon1a on 2026-11-24T00:19:59Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7117956898 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/50#issuecomment-7117956898). Originally posted by [lordon1a](https://github.com/lordon1a) on 2026-11-24T00:19:59Z. --- 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.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!50
No description provided.