DirectStorage: reject file ranges past end before allocation #1417

Closed
hajduzsolt wants to merge 1 commit from upstream-pr/1427 into main
hajduzsolt commented 2026-11-24 15:51:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by hajduzsolt on 2026-11-24T15:51:15Z.


A file-source request allocates its staging buffer before discovering that the requested range is past EOF. Check nonempty ranges against the file length first, including offset overflow. Empty reads keep their existing behavior. Part of #1392.

What is in it

  • crates/xcl/src/hle/dstorage.rs: validate file ranges before allocation and test boundary, overflow and empty-read cases without fixtures.

Tested

  • Windows 11 Pro x64 build 26300, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT 16 GB, driver 32.0.32029.2010; Rust 1.98.1 MSVC, debug.
  • cargo test -p xcl --lib file_ranges_reject_truncation_and_offset_overflow: 1 passed, 0 failed.
  • cargo test --workspace -- --test-threads=4 --nocapture: 752 passed, 0 failed, 41 ignored. The reported passes include tests that return early.
  • SKIPPED: test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state (D3D12 debug layer unavailable).

Regression run

  • Retail smoke runs pending human verification.

main: not run

PR: not run

Not tested

  • Retail title, debug-layer validation, concurrent file growth, and performance impact of the metadata query added for each nonempty file request. This does not cover memory-source or physical-page allocation paths from #1392.

AI use

  • Codex (GPT-6): wrote implementation and unit tests, ran validation, and drafted this description.
<!-- greyfinch-sync:ivall/xcl:issue:6585793022 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1427). Originally posted by [hajduzsolt](https://github.com/hajduzsolt) on 2026-11-24T15:51:15Z. --- A file-source request allocates its staging buffer before discovering that the requested range is past EOF. Check nonempty ranges against the file length first, including offset overflow. Empty reads keep their existing behavior. Part of #1392. **What is in it** - `crates/xcl/src/hle/dstorage.rs`: validate file ranges before allocation and test boundary, overflow and empty-read cases without fixtures. **Tested** - Windows 11 Pro x64 build 26300, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT 16 GB, driver 32.0.32029.2010; Rust 1.98.1 MSVC, debug. - `cargo test -p xcl --lib file_ranges_reject_truncation_and_offset_overflow`: 1 passed, 0 failed. - `cargo test --workspace -- --test-threads=4 --nocapture`: 752 passed, 0 failed, 41 ignored. The reported passes include tests that return early. - SKIPPED: `test_title_draws_with_a_root_signature_under_the_debug_layer` and `uploads_start_from_each_subresources_state` (D3D12 debug layer unavailable). **Regression run** - [ ] Retail smoke runs pending human verification. main: not run PR: not run **Not tested** - Retail title, debug-layer validation, concurrent file growth, and performance impact of the metadata query added for each nonempty file request. This does not cover memory-source or physical-page allocation paths from #1392. **AI use** - Codex (GPT-6): wrote implementation and unit tests, ran validation, and drafted this description.
upstream-sync closed this pull request 2026-11-24 16:06:47 +00:00

Pull request closed

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
xcl-dev/xcl!1417
No description provided.