fix(libcurl): read curl_formget nodes through checked guest copies #27587
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27587"
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 Ducengarth on 2026-11-26T18:49:30Z.
What
curl_formgetread each guestcurl_httppostnode by dereferencing guest memory, so a node pointer the guest cannot read crashed the process.HostFormFromGuestnow copies each node throughGuestCopyIn_nid_no_patchand throws throughNotImplementedAt_nid_no_patchwhen the copy fails, ascurl_formadddoes for its unreadable guest pointers. Thecurl_formgetdebt entry, which is still in the pending fragmentfeat-libcurl-formget.md, now describes the checked copy.Tested
Ubuntu 24.04 (WSL2),
guest_curl_SlistMime_testspasses. Its new checks givecurl_formgetan unreadablenextlink and an unreadable first node, and both now throw instead of crashing.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)🤖 Generated with Claude Code
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T19:06:12Z.
Review: APPROVED
Reviewed — looks good
The change safely copies each form node from guest memory before reading its fields; the two added unreadable-pointer cases verify that failure throws.
What I ran
Reviewed head
bcb4e977e1fa527fd44b82be09dd524c5beee293against the prepared diff. No tests or builds were run; the test result in the PR description is author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No build or tests were run. Reviewed all files listed as changed in the manifest:
core/libs/prx/libcurl/Export.cpp,core/libs/prx/libcurl/tests/CurlSlistMime.cpp, anddocs/dev/debt/changes/feat-libcurl-formget.md. No files were excluded by the provided manifest;files.jsonwas not available in the review bundle. No console behavior was verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-11-27T03:11:21Z.
Review: APPROVED
Checked head
bcb4e977e1. I applied it tomainad7582bad4together with #27588 and #27585, which touch different files. On Windows 11 with WinLibs GCC 15.2 (Release),tools/check_conventions.py --headon each head andtools/debt_fold.py --checkpassed, the build succeeded, and all 4,930 CPU tests passed (I left out the GPU tests).guest_curl_slistmimepassed. Withmain'slibcurl/Export.cppand the new checks, it fails.HostFormFromGuestnow copies each guestcurl_httppostnode throughGuestCopyIn_nid_no_patchbefore reading it, so a badmoreornextpointer, or a bad first node, throws throughNotImplementedAt_nid_no_patchinstead of being read directly. The host node still borrows the guest's string and buffer pointers, as before, and the debt fragment says so.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MertCtn on 2026-12-02T11:44:25Z.
Review: COMMENTED
Verified the Windows side of this one:
guest_curl_slistmimepasses on LLP64.bcb4e977e1:guest_curl_slistmimePassed, including the two new unreadable-node checks (badnextlink and bad first node both throw instead of crashing).check_conventions.pyscoped to this PR (--baseits merge-base) passes.One consistency suggestion, non-blocking: the new
GuestCopyIn_nid_no_patchcopy inHostFormFromGuestdoes not preserveerrno, while the neighboringGuestText::Filland thecurl_formfreepath both save/restore it around the same call. A failed (or even successful)curl_formgetcan therefore clobber the guesterrnowhere the old direct-deref path never touched it. Worth the same two-line save/restore for consistency.Also note:
debt_fold.py --checkfails at this head on the unrelatedfeat-libwebrtc-rnn-vad.mdfragment (predates this PR's base), so I could not validatefeat-libcurl-formget.mdwith the tool — checked by hand instead: single## add Functionalentry, well-formed link, under the length limit.Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:01:57Z.
Review: COMMENTED
Built and ran
guest_curl_slistmimeon Linux with this head integrated. It passed. I tracedcurl_formgetfrom the checked form-node read through the callback and checked that a failed read follows the existing guest error path.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.