summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-06-28 12:32:54 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-06-28 14:47:42 +0200
commit50cce5eb4f7c2627622875d9360b66b6c3234afe (patch)
tree1d71ca680a77ea2fc03eddf67c251465c31ad6d2 /sapi/phpdbg/phpdbg.c
parentc0bf3bc50cfe1ef47a233d5fa3763d7581a57871 (diff)
downloadphp-git-50cce5eb4f7c2627622875d9360b66b6c3234afe.tar.gz
Avoid reliance on arena details on phpdbg oplog
Instead of guessing what the address of the first arena allocation is going to be, embed the sentinel in the oplog_list structure directly.
Diffstat (limited to 'sapi/phpdbg/phpdbg.c')
-rw-r--r--sapi/phpdbg/phpdbg.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 463749ea3a..67cefc75f2 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -449,14 +449,12 @@ static PHP_FUNCTION(phpdbg_start_oplog)
if (!prev) {
PHPDBG_G(oplog_arena) = zend_arena_create(64 * 1024);
-
- PHPDBG_G(oplog_cur) = ((phpdbg_oplog_entry *) zend_arena_alloc(&PHPDBG_G(oplog_arena), sizeof(phpdbg_oplog_entry))) + 1;
- PHPDBG_G(oplog_cur)->next = NULL;
}
PHPDBG_G(oplog_list) = emalloc(sizeof(phpdbg_oplog_list));
PHPDBG_G(oplog_list)->prev = prev;
- PHPDBG_G(oplog_list)->start = PHPDBG_G(oplog_cur);
+ PHPDBG_G(oplog_cur) = &PHPDBG_G(oplog_list)->start;
+ PHPDBG_G(oplog_cur)->next = NULL;
}
static zend_always_inline zend_bool phpdbg_is_ignored_opcode(zend_uchar opcode) {
@@ -633,7 +631,7 @@ static PHP_FUNCTION(phpdbg_end_oplog)
return;
}
- cur = PHPDBG_G(oplog_list)->start;
+ cur = PHPDBG_G(oplog_list)->start.next;
prev = PHPDBG_G(oplog_list)->prev;
efree(PHPDBG_G(oplog_list));