-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Segmentation fault when resizing hash table iterator list while adding #16054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Not sure if that's an engine issue, or some misuse by Spl. Anyhow, PHP-8.3 (and possibly older branches are affected as well). |
Let's be honest, we all know which one of the two it is ;) |
This already corrupts the heap: <?php
$multi_array = ['zero'];
$multi_array[] =& $multi_array;
$it = new RecursiveTreeIterator(new RecursiveArrayIterator($multi_array), 0);
foreach($it as $k => $v) {
} |
Oh actually, this may be engine related for once... |
nielsdos
added a commit
to nielsdos/php-src
that referenced
this issue
Sep 25, 2024
… list while adding zend_array_dup_ht_iterators() loops over the hash table iterators and can call zend_hash_iterator_add(). zend_hash_iterator_add() can resize the array causing a crash in zend_array_dup_ht_iterators(). We solve this by refetching the iter pointer after an add happened.
nielsdos
added a commit
to nielsdos/php-src
that referenced
this issue
Sep 25, 2024
… list while adding zend_array_dup_ht_iterators() loops over the hash table iterators and can call zend_hash_iterator_add(). zend_hash_iterator_add() can resize the array causing a crash in zend_array_dup_ht_iterators(). We solve this by refetching the iter pointer after an add happened.
nielsdos
added a commit
to nielsdos/php-src
that referenced
this issue
Sep 25, 2024
… list while adding zend_array_dup_ht_iterators() loops over the hash table iterators and can call zend_hash_iterator_add(). zend_hash_iterator_add() can resize the array causing a crash in zend_array_dup_ht_iterators(). We solve this by refetching the iter pointer after an add happened.
nielsdos
added a commit
that referenced
this issue
Sep 25, 2024
* PHP-8.3: Fix GH-16054: Segmentation fault when resizing hash table iterator list while adding
nielsdos
added a commit
that referenced
this issue
Sep 25, 2024
* PHP-8.4: Fix GH-16054: Segmentation fault when resizing hash table iterator list while adding
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The following code:
PHP Version
PHP 8.4.0-dev
Operating System
ubuntu 22.04
The text was updated successfully, but these errors were encountered: