mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #2285] tools/bcpack_tables_bptc.py: harden integer/key validation and class/bit-depth bounds #2290
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2290
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2285
Author: @kirigayakazima
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/bcpack-bptc-validation📝 Commits (1)
74bd28atools/bcpack_tables_bptc.py: validate strict integer fields, dict keys, and bit/class bounds📊 Changes
2 files changed (+101 additions, -15 deletions)
View changed files
📝
tests/test_bcpack_tables_bptc.py(+37 -0)📝
tools/bcpack_tables_bptc.py(+64 -15)📄 Description
Claimed in the coordination issue as: BCPACK-BPTC-STRICT-INT-VALIDATION-AND-BIT-BOUNDS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192331643)
What and why
_strict_int()intools/bcpack_tables_bptc.pyto rejectboolandfloatvalues (and non-integer strings) while preserving plain integer and ASCII integer string parsing._iter_entries()for dictionary tables to rejectbool,float, whitespace/signed/non-ASCII-digit keys, and duplicate resolved indices (such as"01"colliding with"1").endpointClassandindexClassvalues within0..3inload_bc6h().load_bc7(): non-negativehistoryEndpointBits(preserving>= 8full-precision handling),0..8forhistoryEndpointConfirmedBits, and0..4forhistoryIndexBits/historyIndexConfirmedBits.tests/test_bcpack_tables_bptc.py.Tested
python -I tests/test_bcpack_tables_bptc.py -v: 29 passed, 0 failed (detachedupstream/mainbaseline with only the updated test file fails with 17 failures).python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q tools/bcpack_tables_bptc.py tests/test_bcpack_tables_bptc.py, andgit diff --cached --check: passed.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.