Skip to content

fix(npcpp): iterate borrowed string-vector bodies - #16325

Closed
JJenkx wants to merge 1 commit into
boykopovar:mainfrom
JJenkx:fix/npcpp-string-vector-bodies-20261106
Closed

JJenkx wants to merge 1 commit into
boykopovar:mainfrom
JJenkx:fix/npcpp-string-vector-bodies-20261106

Conversation

@JJenkx

@JJenkx JJenkx commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What

IntrusivePtr<Vector<String>>::operator-> returns the host-created vector body, but string begin/end treated that pointer as an intrusive-pointer wrapper. This interprets the body magic as a pointer and crashes. Resolve the body with the existing ResolveVectorBody helper, as intrusive-element vector iteration already does.

The regression constructs a vector through exported methods, pushes two strings, obtains the borrowed body through exported operator->, and iterates both representations. It checks ordering, reference count and the owner storage guard before cleanup. No new exports or foreign/native vector layouts are introduced.

Closed as duplicate of #14273 and its descendant #15998. Their old StringVectorElements remains wrapper-only, but their exported String begin/end methods call HostVectorBegin/HostVectorEnd, which already resolve borrowed bodies. My earlier helper-only comparison missed that routing. The reproduction below remains valid for main, but no distinct implementation gap remains relative to those open PRs. Regression evidence was handed to #14273; its branch was not executed in this qualification.

Tested

Linux, commit 33f10ec4a17c607b36604a53d3dfc9855b7751fa, based on main c28413dda903edcfe7fe9d544abe1b7786cb0e31:

  • Main: 13/13 existing CPU CTest groups pass, zero skips/failures. The final regression fixture's body-iteration mode crashes with SIGSEGV against the frozen main module.
  • Change: 13/13 CPU groups pass, zero skips/failures; the default string test includes the regression. The separately selected body-iteration mode exits 0.
  • ASan + UBSan with leak detection: body-iteration exits 0. NP module and fixture instrumented; frozen dependency providers uninstrumented.
  • Dynamic defined symbol names identical: 1,420 on each side. Whitespace and conventions checks have zero errors (conventions reports existing debt-length warnings).
  • Clean merge preview against newer main e509b292479c383dabd18bf5c323eff1afe9d2f3; its NP module/test files are unchanged since the qualified base. This is a merge preview, not an execution of the newer full SDK.

Tests use the production NP module CMake with frozen current-main libc/kernel provider dependencies. This is scoped CPU qualification; no Windows, title, GPU or performance result is claimed.

Logs, JUnit, final fixture, patch, qualifier, scope and overlap review — SHA-256 1841d554778aaecce6648387a6b3152aa6edc8ee80c1f57435b1852b7db22525.

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
  • 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

@github-actions github-actions Bot added the prx label Nov 6, 2026
@JJenkx

JJenkx commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Windows check of head 33f10ec4a1, merged onto main e509b29247 (8dc45d190f, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_np_cpp_web_api_string, guest_np_cpp_web_api_alias_append and guest_np_cpp_web_api_alias_string_vector pass in 3 of 3 runs, none skipped.

AI-assisted: yes.

@JJenkx

JJenkx commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Closing as covered by #14273 (and its descendant #15998). My initial manual overlap review compared StringVectorElements, which remains wrapper-only in those branches, but missed that their exported String begin/end already call HostVectorBegin/HostVectorEnd. Those resolve the borrowed body with ResolveVectorBody, so they cover the same public-API failure by a different route. The earlier statement that those branches leave iteration unfixed was incorrect.

The main reproduction and scoped test results remain valid, but they do not establish a gap in #14273. The final exported-API regression and evidence remain available for its author: construct vector, push strings, obtain the body through exported operator->, iterate wrapper/body, check order/reference count/storage guard, then destroy the owner. Main c28413dda903 fails this test with SIGSEGV; #14273 itself has not been executed in this local qualification.

AI-assisted: yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant