-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Assertion failure when adding more than 2**30 elements to an unpacked array #10240
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 believe we can fix this by decreasing the current value of |
Agreed. Sorry I was working on it already, I should have assigned myself. I've chosen to use a HT_MAX_SIZE of 0x40000000, which is half the current value, and the effective maximum number of elements. I think that the discrepancy between HT_MAX_SIZE and the actual maximum has been introduced when the load factor has been decreased from 1.0 to 0.5 in 34ed8e5. |
No worries! I now understand also understand why the size has to be halved for 64-bit. |
On 32bit we can overflow The hash table size was computed like this back then:
With In #10242, halving |
Thanks for the clear explanation :) |
Description
Found while testing #10149
The following code:
Resulted in this output:
But I expected this output instead:
gdb:
nSize is an uint32_t.
HT_MAX_SIZE
is 0x80000000 (2**31), so nSize+nSize in HT_SIZE_TO_MASK overflows uint32_t, leading to ht->nTableMask == 0.PHP Version
PHP 8.1
Operating System
No response
The text was updated successfully, but these errors were encountered: