-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
ext/bcmath: Fixed pointer subtraction for scale #17986
base: PHP-8.4
Are you sure you want to change the base?
Conversation
Right, do you have a test? |
@nielsdos |
Since this is the code for when In the following code,
However, since only values up to scale 10 are used for comparison, there will be no erroneous results. |
ext/bcmath/libbcmath/src/str2num.c
Outdated
@@ -180,7 +180,7 @@ bool bc_str2num(bc_num *num, const char *str, const char *end, size_t scale, siz | |||
*/ | |||
if (str_scale > 0) { | |||
const char *fractional_new_end = bc_skip_zero_reverse(fractional_end, fractional_ptr); | |||
str_scale -= fractional_new_end - fractional_end; | |||
str_scale -= fractional_end - fractional_new_end; // fractional_end >= fractional_new_end |
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.
Please use c-style comments, i.e. /* */
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.
Seems logical
No description provided.