fix(libSceNKWebKit): keep inspector regex test strings alive #26856

Merged
oneandonlydean merged 1 commit from upstream-pr/26856 into main 2026-11-25 00:47:54 +00:00
oneandonlydean commented 2026-11-25 00:46:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-11-25T00:46:08Z.


What

nkwebkit_inspectorcontentsearchregex fails on Linux on main since #25170: "check failed at line 283". Latin1 and Utf16 in the test take a const reference and return a StringImpl that points into it. const StringImpl widePattern = Utf16(u"中"); builds the std::u16string as a temporary that dies at the end of that statement, so the regex is compiled from a dead stack buffer. Windows happened to keep the bytes; Linux does not. The same pattern sits at two other lines (Latin1("a"), Latin1("")) and passes only by luck. I name the backing strings so they outlive the StringImpl. Test only; the library code is unchanged.

Tested

Linux, Release, one build tree on main fc54d18d8d: the test with this change passes 5 of 5 (ctest --repeat until-fail:5). The same build with the old test file fails at line 283 as on main.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5482917273 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26856). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-11-25T00:46:08Z. --- ### What `nkwebkit_inspectorcontentsearchregex` fails on Linux on main since #25170: "check failed at line 283". `Latin1` and `Utf16` in the test take a const reference and return a `StringImpl` that points into it. `const StringImpl widePattern = Utf16(u"中");` builds the `std::u16string` as a temporary that dies at the end of that statement, so the regex is compiled from a dead stack buffer. Windows happened to keep the bytes; Linux does not. The same pattern sits at two other lines (`Latin1("a")`, `Latin1("")`) and passes only by luck. I name the backing strings so they outlive the `StringImpl`. Test only; the library code is unchanged. ### Tested Linux, Release, one build tree on main fc54d18d8d: the test with this change passes 5 of 5 (`ctest --repeat until-fail:5`). The same build with the old test file fails at line 283 as on main. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!26856
No description provided.