Scripts: reject trailing BCPack table bytes under optimization #2733

Closed
github-bot wants to merge 1 commit from gh-pr/2733/head into gh-pr/2733/base
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 09:10 UTC · original
luckyteagirl:codex/bcpack-trailing-bytes → main · +53 −1 · 2 files · 1 commits · closed without merging

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.

**@⁠luckyteagirl** on GitHub · 2026-11-26 09:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/2733) `luckyteagirl:codex/bcpack-trailing-bytes` → `main` · +53 −1 · 2 files · 1 commits · closed without merging 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.
Python optimization removed the assertion that checked whether the fixed-size VIctory parser consumed the whole input. Reject trailing bytes before opening the output and cover both normal and optimized invocation with synthetic inputs.

AI use: OpenAI Codex (GPT-6) wrote and tested the patch.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:14:18 +00:00
github-bot closed this pull request 2026-11-26 11:14:18 +00:00
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 09:15 UTC · original

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

**@⁠luckyteagirl** on GitHub · 2026-11-26 09:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/2733#issuecomment-7187667535) 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

This discussion has been locked. Commenting is limited to contributors.
No description provided.