fix(libSceCesCs): report the length of a rejected MBCS character as the console does #10722
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10722"
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 boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-24T19:46:15Z.
What
A rejected multibyte character left every output alone. On a PS5 it reports its length and clears the character. I measured it with homebrew payloads that load the console's
libSceCesCs.sprx, over every one- and two-byte sequence of all 15 MBCS profiles withsceCesMbcToUtf32, every0x8F-led three-byte and every0x81 0x30-led three- and four-byte sequence, and the same two-byte sweep throughsceCesMbcTo{Ucs2,Utf8,Utf16}and each encoding's ownTo{Ucs2,Utf8,Utf16,Utf32}for eight profiles. Every form agreed withsceCesMbcToUtf32on the result and the length for all 65792 inputs. On an error the console:0x805C0011, 4 for0x81 0x30in GB 18030), one byte for a bad lead, the bytes before a NUL found after the lead (checked byte by byte, before more bytes are asked for), and the whole sequence for a bad or unassigned trail;The decoders now set that length on each error path, and the single-character wrappers store it with the cleared output. Argument errors keep the outputs untouched.
sceCesEucJpToUcs2andsceCesEucJpToUtf8are left out: #10184 measured those two on a PS5 and changes them, with the same length rule.Tested
guest_ces_mbc: 28 rejected sequences across Shift-JIS, EUC-JP, GBK, GB 18030, UHC and Big5, each through all eightsceCesMbcTo*forms, with the length and output the console gives; these values were looked up in the console dump.guest_ces_chinese,guest_ces_dbcs,guest_ces_japanese: the checks that expected untouched outputs after a rejected character now expect the console's length and cleared character. The otherguest_ces*tests pass.guest_ces*sources pass against thisExport.cpp; a harness built from it matches the console dump's result and length for every recorded sequence apart from table and single-byte differences that are other PRs' topics.67e4ffb032(same tree as the verified2f81a7927f; verify run on my fork; Ubuntu 24.04, GCC, Release, lavapipe): everyguest_ces*test passes. Its one failure,pr_overlap_encoding, fails the same way onmainon that runner (the base side of the same run).check_conventions.pypasses.pr_overlap.pyreports #9175, #9912, #10056, #10183, #10185, #10186, #10426, #10428, #10706 and #10718 on nearby lines ofExport.cpp, theguest_ces*tests or the debt file; none changes these error paths (#10706 moves declarations into export headers).Merge order: this lands before #10718, which is rebased onto it (both change the Shift-JIS and EUC-JP decode paths in
Export.cppand the sameGuestCesJapanese.cppchecks).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T20:04:00Z.
Review: APPROVED
Reviewed the decoder error paths, wrapper output handling, test changes, and debt update. The new helpers distinguish invalid lead, bad/NUL trail, truncated sequence, and unassigned sequence lengths; the wrappers update only the outputs the measured behavior changes. The tests include console-captured sequences and preserve the separate EUC-JP output behavior called out in the debt entry. Hosted conventions/report checks pass; the PR also reports its focused macOS suite and a Linux guest_ces run on the same tree. I could not dispatch the manual full build from this account (GitHub returned HTTP 403). I found no blocking issue.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T20:20:31Z.
Review: APPROVED
Reviewed the full diff at 67e4ffb032f7e08c3b99138f6a5ec29c91fce8d1. The changes propagate measured failure lengths from the decoders and clear only the decoded character output while preserving argument-error behavior. The added MBCS cases cover truncation, bad lead/trail, embedded NUL, unassigned values and GB18030 four-byte lengths across all eight conversion forms; the PR also reports exhaustive console sweeps across 65,792 inputs/profile combinations and passing hosted Linux CES tests. Conventions, labels and eligibility passed. Product Linux/Windows and other focused workflow jobs were skipped under current repository policy; the submitted report separately records a macOS harness run and the Linux runner run.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T02:54:52Z.
Review: APPROVED
Reviewed updated exact head
155abef132c3b7b9a4361d3160d7a39c183a031c. The rebase replaced the old local export declarations with the canonical CES headers while preserving the rejected-sequence length assertions. The current tests still cover invalid lead/trail, truncation, embedded NUL, and unassigned cases across the eight MBCS output forms; the author reports all 14guest_ces*tests and conventions passing on this head. Hosted conventions, eligibility, labels and report pass; product build jobs are skipped. I did not independently rerun the CES suite on this head. No blocking issue remains in the reviewed integration.