1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-15208: Segfault with breakpoint map and phpdbg_clear()

It crashes because it's gonna try accessing the breakpoint which was cleared
by user code in `phpdbg_clear();`. Not all breakpoint data was properly
cleaned.

Closes GH-16953.
This commit is contained in:
Niels Dossche
2024-11-26 21:19:03 +01:00
parent ae84b81bfa
commit 97b03186c4
3 changed files with 20 additions and 0 deletions

4
NEWS
View File

@@ -47,6 +47,10 @@ PHP NEWS
. Fixed bug GH-16695 (phar:// tar parser and zero-length file header blocks).
(nielsdos, Hans Krentel)
- PHPDBG:
. Fixed bug GH-15208 (Segfault with breakpoint map and phpdbg_clear()).
(nielsdos)
- SimpleXML:
. Fixed bug GH-16808 (Segmentation fault in RecursiveIteratorIterator
->current() with a xml element input). (nielsdos)

View File

@@ -369,6 +369,7 @@ PHP_FUNCTION(phpdbg_clear)
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_OPLINE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_MAP]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_COND]);
} /* }}} */

View File

@@ -0,0 +1,15 @@
--TEST--
GH-15208 (Segfault with breakpoint map and phpdbg_clear())
--PHPDBG--
r
q
--FILE--
<?php
phpdbg_break_method("foo", "bar");
phpdbg_clear();
?>
--EXPECTF--
[Successful compilation of %s]
prompt> [Breakpoint #0 added at foo::bar]
[Script ended normally]
prompt>