Repository navigation
Conversation
Member
Author
|
If there are no objections, I'll merge this by the end of the week. |
nikic
reviewed
Nov 3, 2021
Member
Author
|
@dstogov, what do you think about this PR? |
Member
|
I think this may be fixed in a simpler way: - alloc_len = zend_safe_address_guarded(2, new_len, 0);
+ alloc_len = zend_safe_address_guarded(2, new_len, _ZSTR_HEADER_SIZE) - _ZSTR_HEADER_SIZE;
- new_len = zend_safe_address_guarded(1, ZSTR_LEN(eval_result), new_len);
+ new_len = zend_safe_address_guarded(1, ZSTR_LEN(eval_result) + _ZSTR_HEADER_SIZE, new_len) - _ZSTR_HEADER_SIZE;I didn't test this. |
Member
Author
|
Thank you! I'll have a closer look. |
cmb69
marked this pull request as draft
November 25, 2021 13:21
Trying to allocate a `zend_string` with a length only slighty smaller than `SIZE_MAX` causes an integer overflow; we make sure that this doesn't happen by catering to the maximal overhead of a `zend_string`.
cmb69
marked this pull request as ready for review
November 29, 2021 16:12
Member
Author
|
@dstogov, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trying to allocate a
zend_stringwith a length only slighty smallerthan
SIZE_MAXcauses an integer overflow; we need to ensure this doesnot happen, and throw an Error instead.