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

Merge branch 'PHP-8.3'

* PHP-8.3:
  Fix GH-15268: heap buffer overflow in phpdbg (zend_hash_num_elements() Zend/zend_hash.h)
This commit is contained in:
Niels Dossche
2024-08-08 20:35:57 +02:00
2 changed files with 34 additions and 6 deletions

View File

@@ -403,12 +403,15 @@ PHPDBG_INFO(classes) /* {{{ */
phpdbg_print_class_name(ce);
if (ce->parent) {
zend_class_entry *pce;
pce = ce->parent;
do {
phpdbg_out("|-------- ");
phpdbg_print_class_name(pce);
} while ((pce = pce->parent));
if (ce->ce_flags & ZEND_ACC_LINKED) {
zend_class_entry *pce = ce->parent;
do {
phpdbg_out("|-------- ");
phpdbg_print_class_name(pce);
} while ((pce = pce->parent));
} else {
phpdbg_writeln("|-------- User Class %s (not yet linked because declaration for parent was not encountered when declaring the class)", ZSTR_VAL(ce->parent_name));
}
}
if (ce->info.user.filename) {

View File

@@ -0,0 +1,25 @@
--TEST--
GH-15268 (heap buffer overflow in phpdbg (zend_hash_num_elements() Zend/zend_hash.h))
--SKIPIF--
<?php
if (function_exists('opcache_get_status')) die('skip not for opcache because it will link');
?>
--FILE--
<?php
class B extends A {
}
class A {
}
?>
--PHPDBG--
i classes
q
--EXPECTF--
[Successful compilation of %s]
prompt> [User Classes (2)]
User Class B (0)
|-------- User Class A (not yet linked because declaration for parent was not encountered when declaring the class)
|---- in %s on line %d
User Class A (0)
|---- in %s on line %d
prompt>