fix(libSceNpCppWebApi): match Common::String layout and copy semantics #12801
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12801"
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 edubox on 2026-10-29T09:55:55Z.
What
Common::Stringnow follows the module bundled with PPSA21564/PPSA23732 (buildsJ03093737/J03341606) instead of treating+0x10as a growing capacity:+0x10is the used size including the terminator, as the module'sappendandcopyFromcompute it.append(char const*)reallocates exactlyoldLength + textLength + 1, keeps the previous buffer when allocation fails and returns0x80553503for a null string and0x80553504when out of memory.copyFrom(char const*),copyFrom(String const&),clear,size,length,operator==(String const&),setContext, the default constructor and the intrusive reference operations.copyFrom(String const&)adopts the sourceLibContextwhen the destination has none, and keeps it for the empty-source path, as the module does.copyFrom(char const*)was imported by 13 dumps and was not exported before.Evidence, from
sce_module/libSceNpCppWebApi.prxin the dumps (same bytes in both builds):String::append(char const*)0x121b0[+0x10] - 1old length; exact reallocation;0x80553503/0x80553504String::copyFrom(char const*)0x11ee0strlen + 1; same error codesString::copyFrom(String const&)0x11e60String::clear/size/length0x11e20/0x11ff0/0x12000strlenString::operator==(String const&)0x12100strncmpbounded by the left lengthString::intrusive_ptr_add_ref/sub_ref0x11df0/0x11e00Tested
Linux x86-64, GCC 16.2.1,
ctest --test-dir build -R '^guest_np_cpp_web_api': 7/7 passed, includingguest_np_cpp_web_api_alias_append,guest_np_cpp_web_api_alias_string_vectorandguest_np_cpp_web_api_alias_intrusive_vector.tools/check_conventions.py --base origin/mainpasses. No console or title runtime test.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)