Scripts: reject trailing BCPack table bytes under optimization #2723

Closed
luckyteagirl wants to merge 1 commit from upstream-pr/2733 into main
luckyteagirl commented 2026-11-26 09:10:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T09:10:23Z.


Python's optimized mode strips the assertion that checks whether the BCPack table parser consumed all input. A VIctory table with extra bytes can then overwrite the generated Rust file as if it were valid.

What is in it

  • Reject trailing data before opening the output in normal and optimized Python.
  • Test the extra-byte case with an existing destination and verify that valid input generates identical output with either optimization setting.

Tested

  • Windows, Python. With only the tests added to main b49be183, 1 passed and 1 failed. The optimized malformed input unexpectedly exited 0.
  • On this commit, Python script discovery passed 27 tests, including both generator tests. git diff --check passed.

Regression run

Script and test changes only.

Not tested

  • Cargo workspace tests, GPU tests, or retail execution. The regression uses synthetic table data.

AI use

OpenAI Codex (GPT-6) reproduced the issue, wrote the patch and tests, and ran the checks above.

<!-- greyfinch-sync:ivall/xcl:issue:6623279012 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2733). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T09:10:23Z. --- Python's optimized mode strips the assertion that checks whether the BCPack table parser consumed all input. A VIctory table with extra bytes can then overwrite the generated Rust file as if it were valid. **What is in it** - Reject trailing data before opening the output in normal and optimized Python. - Test the extra-byte case with an existing destination and verify that valid input generates identical output with either optimization setting. **Tested** - Windows, Python. With only the tests added to main `b49be183`, 1 passed and 1 failed. The optimized malformed input unexpectedly exited 0. - On this commit, Python script discovery passed 27 tests, including both generator tests. `git diff --check` passed. **Regression run** Script and test changes only. **Not tested** - Cargo workspace tests, GPU tests, or retail execution. The regression uses synthetic table data. **AI use** OpenAI Codex (GPT-6) reproduced the issue, wrote the patch and tests, and ran the checks above.
upstream-sync closed this pull request 2026-11-26 10:06:11 +00:00
luckyteagirl commented 2026-11-26 10:06:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T09:15:20Z.


Closing this draft in favor of #1440. Independent review found that #1440 already replaces the trailing-data assertion with explicit validation, checks the exact input size before output, and adds tests in the same script test file. Our optimized-Python case is covered by that explicit validation and does not warrant a competing PR. Thanks to the #1440 author for the broader fix. AI-assisted duplicate check (OpenAI Codex, GPT-6).

<!-- greyfinch-sync:ivall/xcl:comment:7187667535 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2733#issuecomment-7187667535). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T09:15:20Z. --- Closing this draft in favor of #1440. Independent review found that #1440 already replaces the trailing-data assertion with explicit validation, checks the exact input size before output, and adds tests in the same script test file. Our optimized-Python case is covered by that explicit validation and does not warrant a competing PR. Thanks to the #1440 author for the broader fix. AI-assisted duplicate check (OpenAI Codex, GPT-6).

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!2723
No description provided.