Fix 001-SimpleWeb AOT smoke munmap_chunk invalid pointer (#13995)#14005
Merged
Conversation
…cast string) (#13995). Cache one htmlspecialchars() result for reuse; drop (string) cast on $_REQUEST that triggers AOT double-free with htmlspecialchars(). examples-aot-smoke 001-SimpleWeb: ok. Co-authored-by: Cursor <cursoragent@cursor.com>
2 tasks
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
munmap_chunk(): invalid pointerwhenhtmlspecialchars()was applied twice to a(string) $_REQUEST[...]localhtmlspecialchars()result ($safeName) and reuse it in the page output$_REQUEST['name'] ?? ''without(string)cast (AOT(string)+htmlspecialchars()still has a separate compiler bug)Closes #13995
Root cause (follow-up)
AOT JIT: repeated
htmlspecialchars()on a local holding a superglobal string (especially after(string)cast) double-frees the underlying__string__*. Direct$_REQUEST[...]reads in each call site avoid the crash; a compiler fix belongs inJitStringBuiltinArg/(string)cast lowering.Verification
Note:
examples-aot-smokestill fails later on 004-ApiJson (Current basic block has no parent function) on this harness — reproduced onmasterbefore this change; separate from #13995.Made with Cursor