From 5d7760d341938a55e7613de85a3e1e5a3ba6bcb7 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Fri, 2 Oct 2026 21:13:10 -0500 Subject: [PATCH 1/2] fix(ezitext): reconcile one-key caller and parameter contracts (#1021) --- libs/RVLMiddleware/eZiText/src/clib/zi81key.c | 112 +++++++----------- ...hands-ezitext-onekey-contracts.attempts.md | 96 +++++++++++++++ 2 files changed, 141 insertions(+), 67 deletions(-) create mode 100644 tools/decomp-assist/allhands-ezitext-onekey-contracts.attempts.md diff --git a/libs/RVLMiddleware/eZiText/src/clib/zi81key.c b/libs/RVLMiddleware/eZiText/src/clib/zi81key.c index 9e35dba6..86f5a222 100644 --- a/libs/RVLMiddleware/eZiText/src/clib/zi81key.c +++ b/libs/RVLMiddleware/eZiText/src/clib/zi81key.c @@ -15,28 +15,6 @@ typedef struct { typedef struct { ziU8 keyLow; ziU8 keyHigh; ziU8 code; ziU8 flags; } Zi8AltSoundRecord; - - -typedef struct { - ziU8 language; - ziU8 getMode; - ziU8 subLanguage; - ziU8 context; - ziU8 getOptions; - ziWChar* elements; - ziU8 elementCount; - ziWChar* currentWord; - ziU8 wordCharCount; - ziWChar* candidates; - ziU8 maxCandidates; - ziU16 firstCandidate; - ziU8 wordCandidates; - ziU8 count; - ziU8 letters; - ziU8* scratch; - ziPtr workspace; -} Zi8OneKeyParam; - typedef struct { ziU8 countOnly; ziU8 maxSpellingLength; @@ -203,15 +181,15 @@ const ziWChar zi8PYfinalSpelling[64][4] = { const unsigned long long Zi8SOpinyinArray = 0x0303010705000000ULL; -extern Zi8UInt Zi8Ord2Ord(ziU16, ziPtr); +extern ziU16 Zi8Ord2Ord(ziU16, ziPtr); extern ziU8 Zi8LangSupported(ziU8, ziPtr); extern ziU16 Zi8GetTableCount(ziU8,ziU8,ziPtr); -extern Zi8UInt Zi8GetTableAddress(ziU8,ziU8,ziPtr); -extern void Zi8Memset(); -extern int _Zi8GetCandidates(); -extern void Zi8InitDupWordBuf(); -extern ziU16 Zi8GetPInfo(ziU16,ziWChar *,ziU8,ziPtr); -extern ziU16 Zi8GetZInfo(ziU16,ziWChar *,ziU8,ziPtr); +extern ziU32 Zi8GetTableAddress(ziU8,ziU8,ziPtr); +extern void Zi8Memset(ziU8*,ziU32,ziS32); +extern ziU8 _Zi8GetCandidates(ziGetParam*,ziPtr); +extern void Zi8InitDupWordBuf(ziPtr); +extern ziU32 Zi8GetPInfo(ziU32,ziWChar *,ziU8,ziPtr); +extern ziU32 Zi8GetZInfo(ziU32,ziWChar *,ziU8,ziPtr); extern ziBool Zi8IsDupWordW(ziWChar *,ziU8,ziPtr); extern ziU8 Zi8GetFormatVersion(ziU8,ziPtr); extern ziU16 Zi8Uni2Ord(ziWChar,ziPtr); @@ -219,10 +197,10 @@ extern ziU16 Zi8GetPCode(ziU8 *,ziU8 *); extern ziU8 Zi8MatchOEMdata(ziWChar *,ziU8,ziU8,ziWChar *,ziU16,ziU8,ziU8,ziPtr); extern ziU8 Zi8MatchPUDdata(ziWChar *,ziU8,ziU8,ziWChar *,ziU16,ziU8,ziU8,ziPtr); extern ziWChar Zi8Ord2Uni(ziU16,ziPtr); -extern Zi8UInt Zi8GetZHuwdPtr(ziU8 **,ziU16 *,ziPtr); -extern int Zi8GetPyPhonetic(); -extern ziU8 Zi8GetBpmfPhonetic(); -extern int _Zi8CheckCandidates(); +extern ziU32 Zi8GetZHuwdPtr(ziU32*,ziU16*,ziPtr); +extern ziU8 Zi8GetPyPhonetic(ziWChar*,ziU8,ziU16*,ziU16*,ziU8*,ziU16*,ziU16*,ziPtr); +extern ziU8 Zi8GetBpmfPhonetic(ziWChar*,ziU8,ziU16*,ziU16*,ziU16*,ziU16*,ziPtr); +extern ziU8 _Zi8CheckCandidates(ziGetParam*,ziPtr); Zi8UInt Zi8SpellingZY(ziU16 *output,Zi8UInt key,ziU8 includeTone) { @@ -462,15 +440,15 @@ BACKWARD_SEARCH: goto BINARY_SEARCH; } } -static Zi8UInt Zi8SetFindCand(ziU8 *foundCandidates,Zi8UInt ordinal,ziPtr work) +static Zi8UInt Zi8SetFindCand(ziU8 *foundCandidates,ziU16 ordinal,ziPtr work) { Zi8UInt result; ordinal = Zi8Ord2Ord(ordinal,work); - result = (ziU8)((1 << ((int)(ordinal & 0xffff) % 8)) & - foundCandidates[(int)(ordinal & 0xffff) / 8]); - foundCandidates[(int)(ordinal & 0xffff) / 8] |= - 1 << ((int)(ordinal & 0xffff) % 8); + result = (ziU8)((1 << ((int)ordinal % 8)) & + foundCandidates[(int)ordinal / 8]); + foundCandidates[(int)ordinal / 8] |= + 1 << ((int)ordinal % 8); return result; } @@ -506,7 +484,7 @@ LAB_return_false: return 0; } -Zi8UInt Zi8Get1KeyPressSpelling(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Zi8OneKeyWork *work) +ziU32 Zi8Get1KeyPressSpelling(ziGetParam *params,Zi8OneKeyOptions *options,Zi8OneKeyWork *work) { ziU8 candidateCount; ziBool exactLength; @@ -531,18 +509,18 @@ Zi8UInt Zi8Get1KeyPressSpelling(Zi8OneKeyParam *params,Zi8OneKeyOptions *options ziU16 *output; ziU8 *savedSearchOrder; ziU16 spellingBuffer[8]; - Zi8OneKeyParam searchParams; + ziGetParam searchParams; candidateCount = 0; totalCandidates = 0; optionsMask = params->getOptions; - params->count = 0; params->letters = 0; + params->completion = 0; optionsMask = optionsMask & ~0x10; optionsMask = optionsMask & ~0x20; optionsMask = optionsMask & ~0x40; if (options->maxSpellingLength == '\0') { - params->count = 0; + params->letters = 0; Zi8LogError(100,work); return 0; } @@ -820,7 +798,7 @@ Zi8UInt Zi8Get1KeyPressSpelling(Zi8OneKeyParam *params,Zi8OneKeyOptions *options savedSearchCount = work->searchOrderCount; convertedInput = false; savedSearchFlags = work->searchFlags; - Zi8Memset(&searchParams,0,0x2c); + Zi8Memset((ziU8*)&searchParams,0,0x2c); searchParams.getMode = 0; searchParams.subLanguage = 0x80; searchParams.context = 1; @@ -918,7 +896,7 @@ Zi8UInt Zi8Get1KeyPressSpelling(Zi8OneKeyParam *params,Zi8OneKeyOptions *options work->searchFlags = savedSearchFlags; work->searchOrder = savedSearchOrder; work->searchOrderCount = savedSearchCount; - params->count = searchParams.count; + params->letters = searchParams.letters; work->spellingOnly = 0; if (convertedInput) { if (params->getMode == '\x03') { @@ -937,7 +915,7 @@ Zi8UInt Zi8Get1KeyPressSpelling(Zi8OneKeyParam *params,Zi8OneKeyOptions *options } } if ((options->countOnly == '\0') && (params->getMode == '\x03')) { - for (tableIndex = 0; tableIndex < params->count;) { + for (tableIndex = 0; tableIndex < params->letters;) { while (*output != 0) { if (*output != 0x27) { *output++ |= 0xf300; @@ -1022,12 +1000,12 @@ nextSpelling: } } finishSpelling: - params->count = candidateCount; + params->letters = candidateCount; Zi8LogError(100,work); return totalCandidates; } -int Zi8Get1KeyPressCandidates(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Zi8OneKeyWork *work) +ziU32 Zi8Get1KeyPressCandidates(ziGetParam *params,Zi8OneKeyOptions *options,Zi8OneKeyWork *work) { ziU16 wordBuffer [64]; ziU16 spelling [8]; @@ -1046,7 +1024,7 @@ int Zi8Get1KeyPressCandidates(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Z ziU8 *phraseEntries; ziU16 *currentWord; ziU8 *entryCursor; - ziU8 *userEntries; + ziU32 userEntriesAddress; int duplicateIndex; ziU16 alternateCount; ziU16 ordinalCount; @@ -1148,8 +1126,8 @@ int Zi8Get1KeyPressCandidates(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Z } languageMask = languageMask << 4; remaining = params->firstCandidate; - params->count = 0; params->letters = 0; + params->completion = 0; inputLength = params->elementCount; if (inputLength != 0) { while (inputLength != 0) { @@ -1271,7 +1249,7 @@ int Zi8Get1KeyPressCandidates(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Z tableCursor = Zi8GetTableCount(1,9,work); } if (8 < inputLimit) { - params->wordCandidates = 0; + params->count = 0; goto finishCandidates; } for (index = 0; index < (int)(Zi8UInt)inputLimit; index++) { @@ -1357,7 +1335,7 @@ int Zi8Get1KeyPressCandidates(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Z output[outputIndex++] = candidateCharacter; } if (candidateCount >= params->maxCandidates || outputIndex > outputLimit) { - params->wordCandidates = candidateCount; + params->count = candidateCount; goto finishCandidates; } } else { @@ -1426,7 +1404,7 @@ int Zi8Get1KeyPressCandidates(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Z output[outputIndex++] = candidateCharacter; } if (candidateCount >= params->maxCandidates || outputIndex > outputLimit) { - params->wordCandidates = candidateCount; + params->count = candidateCount; goto finishCandidates; } } else { @@ -1547,7 +1525,7 @@ int Zi8Get1KeyPressCandidates(Zi8OneKeyParam *params,Zi8OneKeyOptions *options,Z output[outputIndex++] = firstOrdinal; } if (candidateCount >= params->maxCandidates || outputIndex > outputLimit) { - params->wordCandidates = candidateCount; + params->count = candidateCount; goto finishCandidates; } } else { @@ -1568,7 +1546,7 @@ nextPhrase: else { finishPhrases: if (params->wordCharCount != '\0') { - params->wordCandidates = candidateCount; + params->count = candidateCount; } } if ((options->countOnly == '\0') && (tableCursor != 0)) { @@ -1629,11 +1607,11 @@ nextSortedOrdinal: ; } } - if ((options->countOnly == '\0') && (ziU8)Zi8GetZHuwdPtr(&userEntries,&userCount,work) != 0) + if ((options->countOnly == '\0') && (ziU8)Zi8GetZHuwdPtr(&userEntriesAddress,&userCount,work) != 0) { for (phraseOrdinal = 0; phraseOrdinal < userCount;) { - if ((params->elementCount == '\0') || ((userEntries[1] & 0x80) != 0)) { - userOrdinal = (ziU16)(userEntries[1] & 0x7f) << 8 | (ziU16)userEntries[2]; + if ((params->elementCount == '\0') || ((((ziU8*)userEntriesAddress)[1] & 0x80) != 0)) { + userOrdinal = (ziU16)(((ziU8*)userEntriesAddress)[1] & 0x7f) << 8 | (ziU16)((ziU8*)userEntriesAddress)[2]; phraseTable = syllableTable + (Zi8UInt)userOrdinal * 0xc; if (((*phraseTable & languageMask) != 0) && ((characterSetTable == 0 || ((characterSet & characterSetTable[(Zi8UInt)userOrdinal]) != 0)))) { @@ -1677,7 +1655,7 @@ nextSortedOrdinal: } nextUserOrdinal: phraseOrdinal++; - userEntries = userEntries + 3; + userEntriesAddress = userEntriesAddress + 3; } } phraseTable = syllableTable; @@ -1740,12 +1718,12 @@ finishCandidates: if ((emitWords) && (outputIndex != 0)) { output[outputIndex++] = 0; } - params->count = candidateCount; + params->letters = candidateCount; Zi8LogError(100,work); return totalCandidates; } -Zi8UInt Zi8ZHCheckSpelling(ziU16 *input,ziU16 *spelling,Zi8UInt inputLength,char *work) +ziBool Zi8ZHCheckSpelling(ziWChar *input,ziWChar *spelling,ziU8 inputLength,ziPtr work) { int index; ziU8 result; @@ -1760,11 +1738,11 @@ Zi8UInt Zi8ZHCheckSpelling(ziU16 *input,ziU16 *spelling,Zi8UInt inputLength,char int syllableStart; int syllableLength; Zi8UInt tableOffset; - ziU8 candidateBuffer [32]; - ziU8 phoneticCodes [32]; - ziU8 phoneticMasks [32]; + ziWChar candidateBuffer [16]; + ziU16 phoneticCodes [16]; + ziU16 phoneticMasks [16]; ziU16 convertedSpelling [64]; - Zi8OneKeyParam getParam; + ziGetParam getParam; ziU8 maskLow; ziU8 codeLow; ziU8 maskHigh; @@ -1805,7 +1783,7 @@ Zi8UInt Zi8ZHCheckSpelling(ziU16 *input,ziU16 *spelling,Zi8UInt inputLength,char } index = 0; syllableStart = index; - for (; index < (int)(inputLength & 0xff); index = index + 1) { + for (; index < (int)inputLength; index = index + 1) { switch (spelling[index]) { case 0xf331: toneMask = 1; @@ -1876,7 +1854,7 @@ nextInputCharacter: } else { if ((input[index] == 0x27) || (input[index] == 0xf360)) { - if (index < (int)(inputLength & 0xff)) { + if (index < (int)inputLength) { convertedSpelling[index] = input[index] = spelling[index]; } else { @@ -1918,7 +1896,7 @@ nextInputCharacter: getParam.elementCount = (ziU8)index; getParam.currentWord = 0; getParam.wordCharCount = 0; - getParam.candidates = (ziWChar *)candidateBuffer; + getParam.candidates = candidateBuffer; getParam.maxCandidates = 1; getParam.firstCandidate = 0; if ((ziU8)_Zi8CheckCandidates(&getParam,work) != 0) { diff --git a/tools/decomp-assist/allhands-ezitext-onekey-contracts.attempts.md b/tools/decomp-assist/allhands-ezitext-onekey-contracts.attempts.md new file mode 100644 index 00000000..68f9e033 --- /dev/null +++ b/tools/decomp-assist/allhands-ezitext-onekey-contracts.attempts.md @@ -0,0 +1,96 @@ +# One-key call and parameter contracts, 2026-10-03 + +Base: 674722c1; branch agent/bittle/onekey-contract-reconstruction. +Owned source: zi81key.c only. This is source-type correctness work with no +percentage gain. No callee implementation or shared header was changed. + +## Retained, definition-backed boundaries + +- Replaced the private ziGetParam replica with the existing shared type. + The old replica's bytes at 0x20/0x21/0x22 were named + wordCandidates/count/letters. The established shared type names those + count/letters/completion. All accesses were renamed by their offsets; + no field was moved or read/written at a different address. The unused last + word retains the same target size. Dispatcher return declarations and the + two public candidate-count return types now agree on their byte/full-word + roles, respectively. +- Added the actual _Zi8GetCandidates and _Zi8CheckCandidates prototypes, + using ziGetParam pointers. Their explicit byte-result handling is preserved. +- Recovered Zi8Ord2Ord's actual ziU16 return together with the local duplicate + helper's ziU16 ordinal parameter. Ordinary typed uses replace the explicit + halfword masks of the former full-word local. Correcting only the external + return lost the exact helper; this coherent pair preserves all 50 of its + instructions and every caller instruction. +- Zi8GetPInfo and Zi8GetZInfo actually accept a ziU32 phonetic code and return + ziU32. Corrected their local declarations; the existing caller's explicit + byte result conversion remains. +- Added the actual Py/Bpmf phonetic prototypes. This exposed two scratch + arrays declared as 32 bytes despite receiving 16 halfword outputs. They + are now 16-element ziU16 arrays, preserving their 32-byte extents. The + candidate output buffer is likewise 16 ziWChars instead of 32 bytes plus + a cast. No new storage or alignment directive was added. +- Zi8GetZHuwdPtr writes a native ziU32 address through its first parameter. + Its local declaration and address-taken receiving variable now use that + actual type. Byte decoding uses an explicit view of userEntriesAddress; + address stepping remains three bytes. This removes the incompatible + pointer-to-pointer/integer-output contract without an extra temporary. +- Zi8GetTableAddress, Zi8Memset and Zi8InitDupWordBuf local declarations now + agree with their actual definitions. The parameter object is cleared + through the memset callee's byte view. +- Zi8ZHCheckSpelling now agrees with its caller in zi8alpha.c: byte Boolean + return, byte input count, and opaque workspace pointer. Its result was + already a byte; removing the input's redundant full-word masks preserves + the entire existing exact body. + +The authoritative definitions are in zi8getc2.c, zi8misc.c, zi8cinfo.c, +zi8match.c and zi8ZHuwd.c. The public count-return declarations are in +zi8getc2.c; the spelling-check declaration is in zi8alpha.c. Only the owned +file was edited. The private option/work views remain in place; this is not +an attempt to consolidate every library type or repair every declaration. + +## Isolated trials + +- PInfo/ZInfo actual declaration pair: neutral +- Bare Py/Bpmf prototypes: compile error exposing byte-array/halfword-pointer + disagreement; fixed by correctly typed same-size output buffers +- Ord2Ord return only: duplicate helper 100 -> 98.8%; rejected +- Ord2Ord return plus typed ordinal: original exact helper restored, neutral +- Shared request type and offset-preserving field names: neutral +- Typed dispatcher prototypes with shared request type: neutral +- Phonetic and candidate halfword output buffers: neutral +- Native user-dictionary address contract: neutral +- Public return/input boundaries: neutral +- Final retained combined contracts: all code/data and metrics unchanged + +Other coherent local spelling/alternate-phonetic parameter-width trials were +neutral and are not included without an external declaration disagreement. +The PUD return/caller-byte trial on the new baseline dropped unit fuzzy to +97.782295% and exact data 1280 -> 1232; it was rejected and is not included. +No blanket byte-cast, declaration-order or register-allocation sweep was used. + +## Verification + +Baseline report: /tmp/ezi-onekey-contract-baseline.json. +Baseline object: /tmp/ezi-onekey-contract/baseline.o. +Final report: /tmp/ezi-onekey-focused-full-report.json. +Full build: /tmp/ezi-onekey-focused-final-build.log. +Detailed gates: /tmp/ezi-onekey-focused-verification.txt. + +All 1027 unit measures are unchanged. Unit fuzzy remains 98.23523%; main +candidate engine remains 96.41927%. Exact functions remain 5/9, exact code +3952/21460, and matched data 1280/1388. No new exact function or percentage +gain is claimed. + +All owned emitted sections have baseline-identical lengths, payloads and +canonical relocations: .text 21496, .rodata 1152, .data 44, .sdata2 8, +extab 72 and extabindex 108. All nine functions have baseline-identical +disassembly, not only equivalent scores. Each of the five existing exact +functions still has ctxdiff diffs 0 and identical instruction counts: +Zi8IsMatch1Key 97, MatchAltSound1Key 341, Zi8SetFindCand 50, +ZiIsSupportedPhonetic 81, Zi8ZHCheckSpelling 419. + +Pool first: identical and empty. Full 43U build passes with the approved +wrapper and WIBO_SJIS_MISSING_IMPORTS=1. DOL SHA1: +26116613f624061ba99c8d1a299aaa6efa85670d. +git diff --check passes. No linking, remote, metadata, new assembly, volatile +workaround, dummy storage, undefined value or forced-register change. -- 2.49.1 From a4b4c664dbb7ded532174d977693eea14d068fd8 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Fri, 2 Oct 2026 21:14:45 -0500 Subject: [PATCH 2/2] fix(chansvm): compare parsed indices without signed shift overflow --- src/channelScript/CHANSVm.c | 4 +- .../CHANSVm-index-width-20261003.md | 71 +++++++++++++++++++ 2 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 tools/decomp-assist/CHANSVm-index-width-20261003.md diff --git a/src/channelScript/CHANSVm.c b/src/channelScript/CHANSVm.c index f1261a6d..4d91638e 100644 --- a/src/channelScript/CHANSVm.c +++ b/src/channelScript/CHANSVm.c @@ -54,7 +54,6 @@ const u64 VmMinusInf = 0xFFF0000000000000ULL; #define VM_READ_BE_U16(b, o) ((u16)((b)[(o)] << 8 | (b)[(o) + 1])) #define VM_READ_BE_U24(b, o) ((u32)((b)[(o)] << 16 | (b)[(o) + 1] << 8 | (b)[(o) + 2])) #define VM_MAKE_U64(hi, lo) ((u64)(u32)(hi) << 32 | (u64)(lo)) -#define VM_S64_FROM_U64(v) ((s64)(u32)((v) >> 32) << 32 | (u64)(u32)(v)) void CHANSVmDebugPrintf(const vmString format, ...) { va_list args; @@ -7789,8 +7788,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) { cmpHigh = 0; cmpLow = -2; cmpVal = VM_MAKE_U64(cmpHigh, cmpLow); - fullVal = VM_S64_FROM_U64(tmp64); - if ((u64)fullVal <= cmpVal) { + if (tmp64 <= cmpVal) { arrayIdx = (u32)tmp64; goto set_index_ok; } diff --git a/tools/decomp-assist/CHANSVm-index-width-20261003.md b/tools/decomp-assist/CHANSVm-index-width-20261003.md new file mode 100644 index 00000000..d02e5b3c --- /dev/null +++ b/tools/decomp-assist/CHANSVm-index-width-20261003.md @@ -0,0 +1,71 @@ +# CHANSVm string-index width correction + +Baseline: `7b8dbf2c96aa9b4490df35932850c59886f76be3` in the prepared +`agent/bittle/chinese-code-width` leaf. Before editing, the owned CHANSVm source +was also identical to the available `origin/main` at `6619098e`. The earlier +Chinese investigation remains unchanged. Only CHANSVm.c and this log change. + +## Correction + +The SET_INDEX string path parsed into a `u64`, reconstructed that value through +`VM_S64_FROM_U64`, then cast it back to `u64` for the bound check. The macro's +signed 64-bit high-word left shift overflows when the parsed value has bit 63 +set. For example, parsing "-1" reaches a signed shift of 4294967295 by 32. + +Compare the original `u64` directly against the existing `0xFFFFFFFE` bound. +Remove the now-unused macro. The integer and floating paths are unchanged. +This removes undefined source behavior; it does not claim a change to the +current MWCC executable, a fuzzy gain, or a new exact function. + +## Original evidence + +- Original CHANSVmStep is at `0x81456354`, with extent `0x1394`. +- `0x814563B8` and `0x814563BC` establish the bound's high and low words as + zero and `0xFFFFFFFE`. +- The parsed-string check at `0x81456E90` through `0x81456EB4` reads the two + parsed words and performs an unsigned two-word comparison. Values greater + than the bound select the existing SET_INDEX error; accepted values forward + their low word as the index. +- These instruction words were checked directly against the original DOL, + independently of relocation matching. The DOL has the required SHA1 below. +- CHANSVmParseInt calls `strtoull` and stores its unsigned result. The local MSL + implementation (`strtoul.c`, lines 327–348) explicitly applies a negative sign + in unsigned width. Both helpers are already exact in the live report. +- Prior CHANSVm attempt logs were checked; the typed integer/float comparison + work did not address this signed reconstruction in the parsed-string path. + +## Tests and measurements + +- Baseline source-extracted UBSan harness fails on "-1" with signed left-shift + overflow. The candidate passes 300,028 parsed-value and unsigned-boundary + cases without a sanitizer error. +- Inputs include zero, `0xFFFFFFFE`, `0xFFFFFFFF`, `0x100000000`, signed-64 + boundaries, maximum unsigned-64, negative decimal strings, parse failures, + and deterministic generated values. The unusual unsigned parsing of + "-18446744073709551615" to 1 remains accepted, matching the existing parser. +- A separate bounded interpreter executes the original DOL comparison slice + for 300,010 values, checking its error branch and accepted index against an + independent high-word/low-word bound reference. Every case passes. +- These are focused host/slice tests, not complete VM or Wii runtime tests. + The parser harness uses a UTF-16-to-ASCII shim and host `strtoull`; MSL's + negative-sign behavior was also checked in its local source. +- Entire compiled object, including all code, data and relocations, is + byte-identical before/after. SHA256: + `f971cabf817dba7e5cb240df01e1e8f814bb0a973e357a594d031046a56e691b`. +- Complete 1,027-unit report is unchanged. CHANSVmStep remains 96.98723%, + 1,253/1,253 instructions. Unit fuzzy remains 99.4341%. +- Exact functions remain 222/233, each individually checked with ctxdiff: + zero differences. Exact code remains 38,136/53,564 bytes; data 6,904/6,904. +- Pool: 125/125 strings identical. Literal advisory: 233 functions, 40 arguments, + no candidates, skips or errors. +- Full 43U `all_source`, report and `ok` gates pass using the assigned wrapper + and WIBO_SJIS_MISSING_IMPORTS=1. `git diff --check` passes. +- DOL SHA1: `26116613f624061ba99c8d1a299aaa6efa85670d`. + +Private local reproduction files are in `/tmp/chans-index-width/`, including +baseline/candidate sources and objects, test_width.py, check_original.py, +sanitizer output, original-address checks, pool/literal results and build logs. +No original binary or disassembly is committed. No header, metadata, compiler, +linking, other-region, remote, or register-allocation change was made. + +GATE: source-width correctness fix; compiler output and all progress preserved. -- 2.49.1