Skip to content

Fix overflow check in OnUpdateMemoryConsumption #10456

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 27, 2023

Conversation

nielsdos
Copy link
Member

memsize is a signed long, therefore the check against the (unsigned long maximum) / 1024² will never trigger. This check worked correctly in d4b3f89 where it checked against the maximum signed value, but was broken in 003346c. Fix it by changing ZEND_ULONG_MAX to ZEND_LONG_MAX.

memsize is a signed long, therefore the check against the
(*un*signed long maximum) / 1024² will never trigger. This check worked
correctly in d4b3f89 where it checked against the maximum signed
value, but was broken in 003346c. Fix it by changing ZEND_ULONG_MAX
to ZEND_LONG_MAX.
@arnaud-lb
Copy link
Member

It does trigger with some values, but it uses the wrong max value indeed

Thank you!

@arnaud-lb arnaud-lb merged commit d7de73b into php:PHP-8.1 Jan 27, 2023
arnaud-lb added a commit that referenced this pull request Jan 27, 2023
* PHP-8.1:
  [ci skip] NEWS
  Fix overflow check in OnUpdateMemoryConsumption (#10456)
  Prevent dtor of generator in suspended fiber (#10462)
arnaud-lb added a commit that referenced this pull request Jan 27, 2023
* PHP-8.2:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix overflow check in OnUpdateMemoryConsumption (#10456)
  Prevent dtor of generator in suspended fiber (#10462)
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.

3 participants