Skip to content

Fix GH-24523: UAF in zend_test_compile_to_ast() on parse error - #24524

Merged
ndossche merged 1 commit into
php:PHP-8.5from
lazerg:fix/gh-24523-compile-to-ast-uaf
Oct 22, 2026
Merged

ndossche merged 1 commit into
php:PHP-8.5from
lazerg:fix/gh-24523-compile-to-ast-uaf

Conversation

@lazerg

@lazerg lazerg commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

On a parse error zend_compile_string_to_ast() frees the arena and returns NULL, but zend_test_compile_to_ast() still destroyed the arena it got back. It now returns early when there is no AST, same as get_default_via_ast() in zend_API.c.

Fixes #24523

@lazerg

lazerg commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

The WINDOWS_X64_ZTS failure isn't caused by this change. The SQL Server Express install failed in the Setup step, before the build started.

@iliaal iliaal linked an issue Oct 22, 2026 that may be closed by this pull request
@ndossche
ndossche self-requested a review October 22, 2026 13:02

@ndossche ndossche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is right.
It's fortunately not visible to users since zend_test is internal.

@ndossche
ndossche merged commit 81dfb44 into php:PHP-8.5 Oct 22, 2026
17 of 18 checks passed
ndossche added a commit that referenced this pull request Oct 22, 2026
* PHP-8.6:
  Fix GH-24523: UAF in zend_test_compile_to_ast() on parse error (#24524)
lazerg pushed a commit to lazerg/php-src that referenced this pull request Oct 22, 2026
* PHP-8.5:
  Fix phpGH-24523: UAF in zend_test_compile_to_ast() on parse error (php#24524)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uaf in zend_test_compile_to_ast() on parse error

2 participants