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

Merge branch 'PHP-8.4'

* PHP-8.4:
  [ci skip] Fix NEWS order
  Fix GH-18018: RC1 data returned from offsetGet causes UAF in ArrayObject
This commit is contained in:
Niels Dossche
2025-03-13 19:11:59 +01:00
2 changed files with 24 additions and 2 deletions

View File

@@ -665,12 +665,14 @@ static bool spl_array_has_dimension_ex(bool check_inherited, zend_object *object
}
}
/* empty() check the value is not falsy, isset() only check it is not null */
bool result = check_empty ? zend_is_true(value) : Z_TYPE_P(value) != IS_NULL;
if (value == &rv) {
zval_ptr_dtor(&rv);
}
/* empty() check the value is not falsy, isset() only check it is not null */
return check_empty ? zend_is_true(value) : Z_TYPE_P(value) != IS_NULL;
return result;
} /* }}} */
static int spl_array_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */

View File

@@ -0,0 +1,20 @@
--TEST--
GH-18018 (RC1 data returned from offsetGet causes UAF in ArrayObject)
--FILE--
<?php
class Crap extends ArrayObject
{
public function offsetGet($offset): mixed
{
return [random_int(1,1)];
}
}
$values = ['qux' => 1];
$object = new Crap($values);
var_dump(empty($object['qux']));
?>
--EXPECT--
bool(false)