-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Assertion `(zend_gc_refcount(&(ht)->gc) == 1) || ((ht)->u.flags & (1<<6))' failed. #10085
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
I can confirm this (happens at least with PHP-8.1); I'm not sure, though, whether that's worth fixing, since the code is pathologic. |
Running git bitsect and found the first bad commit was edc7c8c. By checking the commit message, maybe this can be also triggerred by normal code? The PoC is found by fuzzing so the code is mal-formed. |
I played with it a bit and found a slightly easier reproducer: <?php
$i = &$new_array;
$i[] = $i;
$i[] = $i;
$i[] = 0;
$i[true] += $new_array; // I can only reproduce it with the key true here |
|
result may be a slot in op2. In that case SEPARATE_ARRAY() will change both result and the slot in op2. Looping over op2 and inserting the element results in both reference-less recursion which we don't allow, and increasing the refcount to 2, failing any further insertions into the array. Avoid this by copying result into a temporary zval and performing separation there instead. Fixes phpGH-10085
See #10975 (comment). I had to revert this change. Maybe we can find a different solution. |
Uh oh!
There was an error while loading. Please reload this page.
Description
The following code:
Resulted in this output:
Reproduce steps:
Git commit: b96b88b
PS: Without the debug assertions, the poc doesn't trigger a crash or abort by sanitizer.
PHP Version
PHP 8.3.0-dev
Operating System
Ubuntu 20.04
The text was updated successfully, but these errors were encountered: