Skip to content

zend_hash_check_size: allow nSize <= HT_MAX_SIZE #10244

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

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

arnaud-lb
Copy link
Member

@arnaud-lb arnaud-lb commented Jan 6, 2023

zend_hash_check_size() restricts the nSize parameter to be strictly less than HT_MAX_SIZE, which makes the name of the HT_MAX_SIZE macro slightly confusing.

In this PR I change zend_hash_check_size() so that it allows nSize values <= HT_MAX_SIZE instead of strictly < HT_MAX_SIZE.

This does not actually extend the maximum hash size, as it was already possible to create hashes with a size of HT_MAX_SIZE:

  • zend_hash_packed_grow() and zend_hash_do_resize() accept to grow hashes to a size <= HT_MAX_SIZE
  • zend_hash_check_size() already returns HT_MAX_SIZE for nSize values in the range ]HT_MAX_SIZE/2...HT_MAX_SIZE[

I found this while testing #10149. Also related: #10242.

This is consistent with other uses of HT_MAX_SIZE
@arnaud-lb arnaud-lb marked this pull request as ready for review January 7, 2023 13:09
@arnaud-lb arnaud-lb requested a review from Girgias January 13, 2023 11:34
@arnaud-lb arnaud-lb merged commit 2b19077 into php:master Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants