fix(chansvm): avoid signed shift overflow in parsed index check #1022
Reference in New Issue
Block a user
Delete Branch "agent/bittle/chansvm-index-width"
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?
Source-width correctness
In SET_INDEX's parsed-string path, compare the existing u64 directly against 0xFFFFFFFE instead of reconstructing it through a signed high-word shift and casting back to unsigned. Remove the now-unused reconstruction macro. Integer/float paths stay unchanged.
Original evidence
CHANSVmStep at 0x81456354 establishes the unsigned bound at +0x64/+0x68. Original DOL instructions at 0x81456E90–0x81456EB4 compare the parsed high/low words unsigned. CHANSVmParseInt uses strtoull; local MSL parsing negates in unsigned width, so negative strings can produce values with bit63 set. The old signed shift overflows for those values.
Independent parent verification
No percentage gain or new exact function claimed. No header, configuration, metadata, compiler, linking or storage changes. Includes concise evidence log.
Base:
a894ff5cb7Tested tree:
f9582a0a74DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d
No merge performed or requested by this author.
Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.