Skip to content

Fix AOT CGI QUERY_STRING refresh segfault for SimpleWeb (#29001) - #29004

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-29001-simpleweb-aot-segfault
Aug 8, 2026
Merged

Fix AOT CGI QUERY_STRING refresh segfault for SimpleWeb (#29001)#29004
PurHur merged 1 commit into
masterfrom
agent/issue-29001-simpleweb-aot-segfault

Conversation

@PurHur

@PurHur PurHur commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Closes Release v1.1.0: fix examples 001-SimpleWeb AOT smoke (exit 139 segfault after c:main_after_init; re-#18832) #29001001-SimpleWeb AOT no longer segfaults after c:main_after_init when parsing QUERY_STRING.
  • Root cause: emitParseDelimitedPairs stored strtok’s first pair after branch($loopHead), so the store was dead IR and pairSlot was uninitialized → __phpc_parse_str_url_decode_inplace wrote into code (__mm__malloc).
  • Also: ScalarReturnCheck now runtime-verifies value-boxed scalar returns under strict_types (Zend zend_verify_return_type) so MiniWebApp resolveAppName(): string accepting $cfg['app_name'] works.
  • 006-FileUploadWeb: escape $_FILES['doc']['name'] before reading size (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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Release v1.1.0: fix examples 001-SimpleWeb AOT smoke (exit 139 segfault after c:main_after_init; re-#18832)

1 participant