tooling: recognize smaller zlib windows in section probes #222

Merged
Vonsek merged 1 commit from upstream-pr/225 into main 2026-11-21 18:42:23 +00:00
Vonsek commented 2026-11-21 18:37:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T18:37:06Z.


Change

Recognize RFC 1950 DEFLATE headers with smaller advertised windows when probing aligned tagged section records. The probe checks both header bytes, skips preset-dictionary streams and retains its stored and decoded size limits. RFC 1950 section 2.2

Verification

Windows 11 build 26200.9974, Visual Studio Build Tools 2022 17.14.45, Python 3.12.10, CMake 3.31.6.

  • cmake --preset dev: configured a fresh build directory with the repository Python environment.
  • out/pe-env/Scripts/python.exe -B tests/resource_ranges_check.py: the new case reported 1 valid tagged stream out of 7 on f02c237. All 5 tests passed at 48fff16.
  • out/pe-env/Scripts/python.exe -B tests/script_state_check.py: all 13 tests passed at 48fff16.
  • ctest --preset dev --no-tests=error -R '^resource_range_controls$' -V: 0/1 with the new case on base, 1/1 at 48fff16.
  • ctest --preset dev --no-tests=error -R '^(resource_range_controls|script_state_literals)$' -V: 2/2 at 48fff16, zero skips.
  • git diff --check: passed.

Evidence and follow-up

The original MIT-licensed fixture compresses one synthetic HEAD FOOT section record with window sizes from 512 bytes through 32 KiB. It places seven streams at aligned offsets, one small-window stream at an unaligned offset and one stream with a preset dictionary. The report counts all seven aligned streams that require no dictionary. A separate control checks alignment when the sampled window itself starts at an unaligned file offset.

On this host, median time.perf_counter wall time over nine scan_window(data, 0, "HEAD", "FOOT") calls on an 8 MiB zero buffer went from 1.7 ms to 1.0 ms. On an 8 MiB buffer from random.Random(731).randbytes(8 << 20), it went from 4.2 ms to 13.7 ms. Both implementations reported no records in those buffers.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted with Codex.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6532832896 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/225). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T18:37:06Z. --- ## Change Recognize RFC 1950 DEFLATE headers with smaller advertised windows when probing aligned tagged section records. The probe checks both header bytes, skips preset-dictionary streams and retains its stored and decoded size limits. [RFC 1950 section 2.2](https://www.rfc-editor.org/rfc/rfc1950.html#section-2.2) ## Verification Windows 11 build 26200.9974, Visual Studio Build Tools 2022 17.14.45, Python 3.12.10, CMake 3.31.6. - `cmake --preset dev`: configured a fresh build directory with the repository Python environment. - `out/pe-env/Scripts/python.exe -B tests/resource_ranges_check.py`: the new case reported 1 valid tagged stream out of 7 on `f02c237`. All 5 tests passed at `48fff16`. - `out/pe-env/Scripts/python.exe -B tests/script_state_check.py`: all 13 tests passed at `48fff16`. - `ctest --preset dev --no-tests=error -R '^resource_range_controls$' -V`: 0/1 with the new case on base, 1/1 at `48fff16`. - `ctest --preset dev --no-tests=error -R '^(resource_range_controls|script_state_literals)$' -V`: 2/2 at `48fff16`, zero skips. - `git diff --check`: passed. ## Evidence and follow-up The original MIT-licensed fixture compresses one synthetic `HEAD FOOT` section record with window sizes from 512 bytes through 32 KiB. It places seven streams at aligned offsets, one small-window stream at an unaligned offset and one stream with a preset dictionary. The report counts all seven aligned streams that require no dictionary. A separate control checks alignment when the sampled window itself starts at an unaligned file offset. On this host, median `time.perf_counter` wall time over nine `scan_window(data, 0, "HEAD", "FOOT")` calls on an 8 MiB zero buffer went from 1.7 ms to 1.0 ms. On an 8 MiB buffer from `random.Random(731).randbytes(8 << 20)`, it went from 4.2 ms to 13.7 ms. Both implementations reported no records in those buffers. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted with Codex.
upstream-sync closed this pull request 2026-11-24 06:41:53 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:47:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T18:37:17Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T18:39:24.063709Z 48fff16 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7067388826 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/225#issuecomment-7067388826). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T18:37:17Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"48fff165339f1fad6c332df528480282d2c15f00","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-21T18:39:24.063709Z">2026-11-21T18:39:24.063709Z</relative-time> | `48fff16` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
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
R0Y00/Xbox2Windows!222
No description provided.