-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix GH-15712: overflow on float print with precision ini large value. #15715
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
Conversation
When allocating enough room for floats, the allocator used overflows with large ndigits/EG(precision) value which used an signed integer to increase the size of thebuffer. Testing with the zend operator directly is enough to trigger the issue rather than higher level math interface.
for(k = 0; | ||
sizeof(Bigint) - sizeof(ULong) - sizeof(int) + (size_t)j <= (size_t)i; | ||
sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't k
and i
also be size_t
? Seems like this file could make use of a bit of cleanup to get rid of all the K&R definitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought of it for sure but :
- the issue is on
j
incrementation alone. - it is a stable branch, I think the cleanup you mention is more appropriate for
master
branch (thinking if there is more implications fromint
=>size_t
changes also, etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right this targets 8.2... yeah sure then do the minimal changes
Zend/zend_strtod.c
Outdated
#ifdef KR_headers | ||
rv_alloc(i) int i; | ||
#else | ||
rv_alloc(int i) | ||
rv_alloc(size_t i) | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you wanted to only do this change in master? As you didn't properly update the KR version here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no I do not want to, I think changing j (and eventually k) here should suffice wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think changing just j
is fine.
Choosing here to shrink the requested allocation to its max value.
Choosing here to shrink the requested allocation to its max value.
When allocating enough room for floats, the allocator used overflows with
large ndigits/EG(precision) value which used an signed integer to
increase the size of thebuffer.
Testing with the zend operator directly is enough to trigger
the issue rather than higher level math interface.