diff --git a/NEWS b/NEWS index 5a865955281d..84b9c6deb9b6 100644 --- a/NEWS +++ b/NEWS @@ -111,6 +111,9 @@ PHP NEWS - PGSQL: . Fixed pg_lo_write() rejecting data containing null bytes. (Ilia Alshanetsky) +- phpdbg: + . Fixed bug GH-13230 (use-after-free at phpdbg shutdown). (Ilia Alshanetsky) + - Posix: . Reverted the validity check on the flags argument of posix_access(). (David Carlier) diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c index a2e39e15a6ca..e617a7b73cb3 100644 --- a/sapi/phpdbg/phpdbg_watch.c +++ b/sapi/phpdbg/phpdbg_watch.c @@ -979,6 +979,9 @@ void phpdbg_remove_watch_element(phpdbg_watch_element *element) { } void phpdbg_backup_watch_element(phpdbg_watch_element *element) { + if (!element->watch) { + return; + } memcpy(&element->backup, &element->watch->backup, /* element->watch->size */ sizeof(element->backup)); } @@ -1097,6 +1100,7 @@ void phpdbg_clean_watch_element(phpdbg_watch_element *element) { if (zend_hash_num_elements(elements) == 0) { phpdbg_remove_watchpoint(element->watch); } + element->watch = NULL; } } diff --git a/sapi/phpdbg/tests/bug73927.phpt b/sapi/phpdbg/tests/bug73927.phpt index bb54f4e17617..81a1d2fa47fe 100644 --- a/sapi/phpdbg/tests/bug73927.phpt +++ b/sapi/phpdbg/tests/bug73927.phpt @@ -1,11 +1,5 @@ --TEST-- Bug #73927 (phpdbg fails with windows error prompt at "watch array") ---SKIPIF-- - --PHPDBG-- b 19 r