Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ PHP NEWS

- Phpdbg:
. Fix wrong command names. (ndossche, Weilin Du)
. Fixed bug GH-22480 (Use-after-free when re-watching an already-watched
variable). (Ilia Alshanetsky)
. Fixed over-read when watching a packed array element. (Ilia Alshanetsky)
. Fixed double free of watch element chains. (Arnaud)

- Readline:
. Fixed a crash in readline_info() when completion_append_character
Expand Down
11 changes: 10 additions & 1 deletion sapi/phpdbg/phpdbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
return SUCCESS;
} /* }}} */

static ZEND_MODULE_POST_ZEND_DEACTIVATE_D(phpdbg) /* {{{ */
{
phpdbg_release_watch_elements();

return SUCCESS;
} /* }}} */

/* {{{ Attempt to set the execution context for phpdbg
If the execution context was set previously it is returned
If the execution context was not set previously boolean true is returned
Expand Down Expand Up @@ -688,7 +695,9 @@ static zend_module_entry sapi_phpdbg_module_entry = {
PHP_RSHUTDOWN(phpdbg),
NULL,
PHPDBG_VERSION,
STANDARD_MODULE_PROPERTIES
NO_MODULE_GLOBALS,
ZEND_MODULE_POST_ZEND_DEACTIVATE_N(phpdbg),
STANDARD_MODULE_PROPERTIES_EX
};

static inline int php_sapi_phpdbg_module_startup(sapi_module_struct *module) /* {{{ */
Expand Down
13 changes: 9 additions & 4 deletions sapi/phpdbg/phpdbg_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,18 @@ int phpdbg_btree_insert_or_update(phpdbg_btree *tree, zend_ulong idx, void *ptr,
}

{
phpdbg_btree_branch *memory = *branch = pemalloc((i + 2) * sizeof(phpdbg_btree_branch), tree->persistent);
phpdbg_btree_branch *memory = pemalloc((i + 2) * sizeof(phpdbg_btree_branch), tree->persistent);
phpdbg_btree_branch *node = memory;
do {
(*branch)->branches[!((idx >> i) % 2)] = NULL;
branch = &(*branch)->branches[(idx >> i) % 2];
*branch = ++memory;
node->branches[!((idx >> i) % 2)] = NULL;
node->branches[(idx >> i) % 2] = node + 1;
node++;
} while (i--);
node->result.idx = idx;
node->result.ptr = ptr;
*branch = memory;
tree->count++;
return SUCCESS;
}
} else if (!(flags & PHPDBG_BTREE_UPDATE)) {
return FAILURE;
Expand Down
Loading
Loading