shader_stats: reject traversal shader names, support UTF-8 BOM, and harden CLI/number guards (SHADER-STATS-VALIDATION-AND-CLI) #1607
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1607"
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 ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T05:48:37Z.
Item ID:
SHADER-STATS-VALIDATION-AND-CLI(unlisted; coordination issue #14 is at GitHub's 2,500-comment cap with no open successor at submission time, and no open PR touchesscripts/shader_stats.py).What changed
scripts/shader_stats.py,_safe_shader_name,load_stats): previouslyos.path.join(disasm, name + ".s")allowed absolute paths or../entries instats.csvto read.sfiles outside<disasm dir>. Nowload_stats()validates that each row'snameis a single non-empty filename stem with no path separators, drive prefix, NUL byte,.or...load_stats): decodestats.csvwithutf-8-sigso BOM-prefixed CSVs do not fail withmissing required header column(s): name.<disasm dir>before matching listings (main): report<disasm dir>: not a directoryinstead of silently skipping every shader and exiting with"no shader is in both...".boolinnumber()and emptyvlistinoriginal():number(True)previously crashed insideDecimal(True)with an uncaughtTypeError, and an emptyvlistcrashedmax().main(argv=None)option and path parsing: accept optionalargv, check"--details" in argvinstead ofsys.argv, reject unknown single-dash flags (e.g.-d) asunknown optioninstead of misparsing them as positional arguments, and reject whitespace-only<stats.csv>/<disasm dir>.tests/test_shader_stats.py): 6 new test methods covering all of the above (no game files, no GPU).Verification
python3 -W error -I tests/test_shader_stats.py -v: 29 passedpython3 -W error -I tests/test_text_write_line_endings.py: passedpython3 -I scripts/check_no_game_data.py scripts/shader_stats.py tests/test_shader_stats.py: cleanpython3 -m compileall -q scripts/shader_stats.py tests/test_shader_stats.py: cleantests/test_shader_stats.pyagainst unpatchedmain:scripts/shader_stats.py): 11 failures, 1 error across the 29 tests (all 6 new tests fail on unpatchedmain).Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T05:48:47Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T10:36:14Z.
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 18 PRs (their tests, the tests importing the changed modules, the docs tests) on main
3ca0707: no new failure, Linux / Python 3.13.AI-assisted (Claude Code, Claude Opus 5.5)