Repository navigation
Conversation
…acters through checked guest copies sixCharacterHashStringToInteger read the caller's characters and the terminator through the guest pointer, so an unmapped or unreadable string crashed the host. Each character is now read with a one-byte GuestCopyIn_nid_no_patch, in the same order and stopping at the same invalid character as before, so a short string at the end of a readable page still fails as an invalid hash. A string that can't be read throws std::invalid_argument, as a null or malformed one does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
What
WTF::sixCharacterHashStringToIntegerread the caller's six characters and the terminator through the guest pointer, so an unmapped or unreadable string crashed the host.Changes:
GuestCopyIn_nid_no_patch, in the same order and stopping at the same invalid character as before. So a short string that ends near the end of a readable page still fails as an invalid hash rather than as unreadable.std::invalid_argument, as a null or malformed one does.Results for readable strings are unchanged. The function reads at most 7 bytes, so the per-byte copies cost nothing measurable.
Tested
Linux (Ubuntu 26.04.1, kernel 7.0), GCC 15.2, Ninja, Release,
-DBUILD_TESTING=ON:nkwebkit_wtfgains an unmapped string (0x10) forsixCharacterHashStringToInteger, which throws. The existing checks of valid, short, long and malformed hashes still pass.nkwebkit_wtfpasses, 3 runs.main'sWtfPrimitives.cppand the new check,nkwebkit_wtfends infatal SIGSEGV (code 1) at address 0x0000000000000010.nkwebkit_wtfpasses, and withmain'sWtfPrimitives.cppand the new check it ends in a segfault.3f3fc83a8dmerged intomain168921678f(Windows 11, i7-12700K, WinLibs GCC 15.2.0, Release):nkwebkit_wtfpasses 3 of 3 runs.git merge-treeagainstmainis clean. feat(libSceNKWebKit): implement WTF FileSystemImpl hardLink, createSymbolicLink and appendFileContentsToFileHandle boykopovar/AnyPS5#19823, feat(libSceNKWebKit): implement WTF FileSystemImpl existence, delete and volume helpers over the guest filesystem boykopovar/AnyPS5#19822 and feat(libSceNKWebKit): implement WTF::GregorianDateTime constructors boykopovar/AnyPS5#14478 also edittests/Wtf.cpp, none of them this check;git merge-treeof this branch with each is clean.tools/check_conventions.pypasses on the branch and this body.tools/debt_fold.py --checkreports nothing for this fragment.3f3fc83a8d, applied with other PRs ontomainfd4aeed483(one combined tree, not this PR alone), Windows 11, WinLibs GCC 15.2.0 r7, Release, no validation layer: the 3guest_wtf_data_log*tests pass on an NVIDIA GeForce RTX 3080 (driver 621.24).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)Summary by CodeRabbit