Skip to content
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

Avoid overflow in zend_list_insert #7437

Closed
wants to merge 1 commit into from

Conversation

OttoHollmann
Copy link

As described in https://bugs.php.net/bug.php?id=81399 declaring index as int may lead to overflow and later in segfault. Let's declare it as zend_long, because function zend_hash_index_add_new accepts zend_ulong.

@nikic
Copy link
Member

nikic commented Sep 3, 2021

As mentioned on the bug report, changing the type only here is not sufficient, because the ID stored in the resource structure will still get truncated. For PHP 8.1, we have switched the resource ID to zend_long, so the problem is properly resolved there. For older versions, we now error when overflowing the integer space.

@nikic nikic closed this Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants