mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:15:52 +01:00
[PR #518] [MERGED] MODS-PARSE-HEX-PREFIX: reject bare 0x/0X prefix in parse_model_id #565
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#565
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/518
Author: @xroneyaa
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism
Base:
main← Head:fix/mods-parse-empty-hex-prefix📝 Commits (1)
d6ca1fdmods: reject bare 0x/0X prefix in parse_model_id📊 Changes
2 files changed (+7 additions, -2 deletions)
View changed files
📝
runtime/src/mods.h(+2 -2)📝
runtime/test/mods_test.cpp(+5 -0)📄 Description
Claimed 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).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.