MODS-PARSE-HEX-PREFIX: reject bare 0x/0X prefix in parse_model_id #518
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!518
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/518/head"
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?
@xroneyaa on GitHub · 2026-11-24 06:51 UTC · original
xroneyaa:fix/mods-parse-empty-hex-prefix→main· +7 −2 · 2 files · 1 commits · merged 2026-11-24 16:11 UTCClaimed in the coordination issue as: MODS-PARSE-HEX-PREFIX
What and why
In
runtime/src/mods.h,leonida::mods::parse_model_idchecksif (text.size() > 2 && text[0] == '0' && (text[1] == 'x' || text[1] == 'X'))before parsing hexadecimal digits. A bare"0x"or"0X"(text.size() == 2) skipped the hex branch, fell through toout = joaat(text), and returnedtrueinstead of refusing the malformed hex value as the comment specifies.This accepts
text.size() >= 2for the"0x"/"0X"prefix check and rejectstext.size() == 2alongsidetext.size() > 10, leavingjoaat()untouched. It also adds unit coverage inruntime/test/mods_test.cppverifying"0x","0X", and a"0x"archetype swap entry are refused without clobberingout.Tested
mods_testwith MSVC 19.50 / Ninja (0 warnings)ctest --test-dir runtime/build --output-on-failure -R "^mods$"-> 1/1 Passed (0.01 s)python -I scripts/check_no_game_data.py runtime/src/mods.h runtime/test/mods_test.cpp-> exit 0GPUs tested: n/a (CPU-only unit test)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed (n/a — no translator rule added).