Fix AOT CGI QUERY_STRING refresh segfault for SimpleWeb (#29001) - #29004
Merged
Conversation
Store strtok's first pair before branching in parse_delimited — a post-terminator store left pairSlot uninitialized so url_decode wrote into code. Also runtime-verify value-boxed scalar returns under strict_types (MiniWebApp), and escape FILES name before reading size in 006 to avoid a nested-FILES lifetime clash. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Aug 8, 2026
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.
Summary
001-SimpleWebAOT no longer segfaults afterc:main_after_initwhen parsingQUERY_STRING.emitParseDelimitedPairsstored strtok’s first pair afterbranch($loopHead), so the store was dead IR andpairSlotwas uninitialized →__phpc_parse_str_url_decode_inplacewrote into code (__mm__malloc).ScalarReturnChecknow runtime-verifies value-boxed scalar returns understrict_types(Zendzend_verify_return_type) so MiniWebAppresolveAppName(): stringaccepting$cfg['app_name']works.006-FileUploadWeb: escape$_FILES['doc']['name']before readingsize(nested FILES lifetime clash exposed once refresh worked).Test plan
./script/docker-exec.sh -- bash -lc './phpc build -o /tmp/simpleweb examples/001-SimpleWeb/example.php && QUERY_STRING=name=Smoke /tmp/simpleweb'→<h1>Hello Smoke</h1>, exit 0./script/docker-exec.sh -- bash -lc './script/examples-aot-smoke.sh'→ ok (000–009)vendor/bin/phpunit test/unit/ParseStrUserScriptCstrKernelShrinkTest.php./script/release-readiness.sh --full --json(running)No C runtime added; parse_str / return-check fixes are PHP/LLVM lowering only.
Made with Cursor