bcpack: extract main(argv) and add regular-file and packet size guards in bcpack_symbols with CLI suite #2596
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2604"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-25T22:57:55Z.
Summary
main(argv: list[str] | None = None) -> intintools/bcpack_symbols.pyreturning0on success withraise SystemExit(main())under__main__._validate_shape(alphabet_bits, symbols)and added upfrontstat()+stat.S_ISREG+1 <= st_size <= MAX_INPUTpacket guards beforeopen(), while preserving existingtests/bcpack_symbols_check.pycaller stderr and exit-1 contracts.tests/bcpack_symbols_cli_check.py(directmain(argv), valid single/multi-lane and exactMAX_INPUTpackets, upfront no-openmissing/directory/empty/oversize guards, width/symbol bounds, trailing non-zero and corrupt packet refusals, and Python 3.14-safe argparse error checks) and registeredbcpack_symbols_cli_checkinCMakeLists.txtwithTIMEOUT 60.Verification
Rebased cleanly onto
upstream/main(f03cf16f, commitaf82faaa) and verified:Adversarial mutation audit in an isolated temp copy killed 13/14 targeted mutations across regular-file, size-bound, validation-order, trailing-byte, order-trace, exit-code, argv-passthrough, boolean-type, and lane-shape guards.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:01:53Z.
Review: COMMENTED
Review of head
af82faaa(0 commits behind main). Verdict: sound, no blocking findings.Checked:
tools/bcpack_symbols.py:_validate_shapeis a pure extraction of the old checks indecode(), same messages.main(argv)now stats the packet first, refuses non-regular files and sizes outside 1..MAX_INPUT beforeopen(), then validates shape. Errors still go throughparser.exit(1, "BCPack symbols: ...").decode()keeps its own size check, so the library path is unchanged.main(argv)suite).tests/bcpack_symbols_cli_check.pyis registered in CMake with TIMEOUT 60 next to the siblingbcpack_symbols_check.Commands run (worktree on the exact head):
python3 -B tests/bcpack_symbols_cli_check.py-> OK (5 tests)python3 -B tests/bcpack_symbols_check.py-> OKpython3 tests/docs_links_check.py-> passedpython3 tests/bidi_controls_check.py-> passedgit diff --check origin/main...HEAD-> cleanS_ISREGguard; removed thest_sizerange guard; changedreturn 0toreturn 1.Python-only change, so no GPU/game behavior is involved.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:02:39Z.
Win2025 WARP receipt for head
af82faaa(Python-only PR; both bcpack_symbols suites run).Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
af82faaaa387bbd0e1b0717285f7ea997adb0c88:tests/bcpack_symbols_check.pyok (1.9s),tests/bcpack_symbols_cli_check.pyok (0.8s)12.8sAI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:04:15Z.
Win2025 WARP receipt for head
af82faaa.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
af82faaaa387bbd0e1b0717285f7ea997adb0c88:--preset dev):cmake --build --preset dev -- -j 2):2.09s(configure2.52s)ctest --preset dev -R 'bcpack_symbols' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (1.12s:bcpack_symbols_cli_check0.99s)/O2(--preset release):cmake --build --preset release -- -j 2):3.10s(configure2.55s)ctest --preset release -R 'bcpack_symbols' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (0.95s:bcpack_symbols_cli_check0.83s)tests/bcpack_symbols_check.pyok (1.8s),tests/bcpack_symbols_cli_check.pyok (0.8s)sccache: 18/28 hits; wall23.8sAI-assisted; commands listed were executed locally.