Repository navigation
fix(utility): keep tail-merged C strings in Go and Rust mode - #402
Merged
danielplohmann merged 3 commits intoOct 15, 2026
Merged
Conversation
An unpaired reference stopped at the next referenced address, which cut "url=" at the reference to its "=" suffix. Skip the cut when the target is the string's last character, nothing else points into the string, and the string starts a run. Adds a go1.24.7 linux/amd64 fixture so Go mode runs on a real pclntab.
danielplohmann
approved these changes
Oct 15, 2026
danielplohmann
left a comment
Owner
There was a problem hiding this comment.
Approved on 1cec0bc.
Checked on Python 3.11.16: ruff check and format clean, full suite 2397 passed, 2 skipped. Reproduced the mirai_x64 figure with the /rustc/ marker planted in padding, compared per (ins_addr, data_addr): 16 strings shortened against unplanted on master, 13 on this branch. url= (twice) and Cookie: come back, and the \r\n chain and the packed abcdefgh... / HWCLVGAJ tables stay cut, as described.
Two non-blocking notes, both handled on our side in the 4.11.0 release PR, so nothing to push here:
- The last check in
_tail_mergedcannot fail.targetisend - 1by the time it runs, so the first reference past it is always at or pastend. An instrumented run over both string test files made 860 calls and never reached it. The "only other reference" property is already guaranteed bynext_targetbeing the first reference afteroffset. Fine to drop it whenever the file is touched next. - The changelog bullet does not name its tree (rule 4). The release PR adds
1cec0bc3ee5594037a5f52e1e0eaeb8262747418and the 16 -> 13 figure, and updates #382's cost sentence to match.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the two non-blocking notes on #382.
url= on mirai_x64. This was not the Go-mode minimum. The compiler stores
"="as the tail of"url=", andmov esi, 0x40d673references it on its own, so the unpaired read stopped at that reference and gave"url". The cap is now skipped when the next target is the string's last character, nothing else points into the string, and the string starts a run (the byte before it can't end a printable string). A target that starts a UTF-16 string, as inrust_pe_gnu's\cmd.exe, still cuts.Results against master, compared per string:
mirai_x64with a planted pclntab header or/rustc/path keepsurl=andCookie:(3 refs longer).rust_pe_gnu, unplantedmirai_x64, and my go1.24.7 amd64/386 and Rust builds are unchanged."\r\n\r\n","\r\n","\n") are still cut, because the middle one doesn't start a run, and packed Rust literals look the same there.go1.24.7 not reproducible. Adds
tests/go_hello_amd64_xored(1 MB). It is a go1.24.7 linux/amd64 hello program built with-trimpath -ldflags="-s -w -buildid=", and its source is in the test docstring. The fixture tests check that Go mode readssmdaGoMarkerandhello thereat their length, with at most one string over 200 chars. Before #382 the same binary gave 54 refs and neither literal.ruff, ty, the full suite and the fixture gate pass on Python 3.11.