Repository navigation
Conversation
DCE rewrites a dead instruction whose operand still needs freeing into a FREE, but kept the instruction's extended_value. After (float) and (array) casts and empty() it has bit 0 set, which ZEND_HANDLE_EXCEPTION reads as ZEND_FREE_ON_RETURN: when a destructor run by that FREE throws, the throw point moves by the FREE's op2, which is (uint32_t)-1, and cleanup_live_vars() frees the operand a second time. Closes phpGH-25836
The DB-Lib error and message handlers estrdup() server and library text into the connection's pdo_dblib_err. For a persistent connection, errors raised through PDO::exec() and the transaction and lastInsertId() calls stay there until the next statement execute, so a request that ends after such an error leaves pointers into the reset request heap. The next request efree()s them from the message or error handler or the cursor closer, and module shutdown does from the handle closer. Free them from persistent_shutdown once the last PDO object using the connection is released. Closes phpGH-25159
…#25719) Dereference the options element of the context parameters before checking its type, so stream_context_create() and stream_context_set_params() accept references to valid options arrays. References to other types still raise a TypeError. Co-authored-by: Gina Peter Banyard <girgias@php.net> Closes php#25719
…down. Objects outliving RSHUTDOWN dropped an empty archive at refcount 0 through the already destroyed fname map, while another object still held it. The archive is now left to its last holder. Fix phpGH-25722 Close phpGH-25728
socket_addrinfo_lookup(), socket_bind(), socket_connect(), socket_sendto() and socket_sendmsg() would otherwise resolve only the part before the NUL byte. Closes phpGH-25774
When zend_string_safe_falloc() fails under memory_limit, php_str_to_str_i_ex() returned NULL without releasing the lowercased needle. Closes phpGH-25848
…rays A recursive watch on an array registered its id on the child element phpdbg creates for the array rather than on the watch root. The root owns that child and frees it whenever its subtree is torn down, leaving a dangling pointer in watch_elements that phpdbg_release_watch_elements() read at shutdown. Register the root instead, and let phpdbg_remove_watch_element() leave a root's subtree to phpdbg_remove_watch_element_recursively(): it freed the root's child before recursing into it, which already crashed on deleting a recursive watch whose variable had become an array.
iliaal
force-pushed
the
fix/phpdbg-watch-release-uaf
branch
from
November 28, 2026 15:31
15771f3 to
b0b0253
Compare
Owner
Author
|
Promoted upstream as php/php-src phpGH-25876. |
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.
With
w r $aon an array, phpdbg registered the watchpoint id on the internal$a[]child instead of the watch the user created. That child is freed whenever the watch's subtree is torn down, sophpdbg_release_watch_elements()read freed memory at script end, andw ddeleted the wrong watch.Registering the real watch exposed a second use-after-free in
phpdbg_remove_watch_element(), which freed a recursive root's child before recursing into it. That already crashed when deleting a recursive watch whose variable had become an array.The notice for a recursive watch on an array now reads
[Added recursive watchpoint #N for $a], matching what phpdbg prints forw ron a non-array; gh22480_2.phpt is updated for it.Found while validating staging #366. watch_008 and watch_009 fail before and pass after under ASAN on PHP-8.4; sapi/phpdbg/tests pass on 8.4, 8.6 and master.