Skip to content

Fix GH-11876: ini_parse_quantity() accepts invalid quantities #11910

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

Closed
wants to merge 1 commit into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Aug 8, 2023

No description provided.

@Girgias Girgias requested a review from arnaud-lb August 8, 2023 09:44
@Girgias Girgias linked an issue Aug 8, 2023 that may be closed by this pull request
@Girgias
Copy link
Member Author

Girgias commented Aug 9, 2023

Windows failures are unrelated

smart_str_free(&invalid);
return 0;
}
if (UNEXPECTED(digits != zend_ini_consume_quantity_prefix(digits, str_end))) {
Copy link
Member

@devnexen devnexen Aug 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to me could be interpreted/simplified slightly as :

if (UNEXPECTED(digits == str_end) || UNEXPECTED(digits != zend_ini_consume_quantity_prefix(digits, str_end)) { goto invalid_quantity; }

eventually even having a const char *errmsg so line 614 can be addressed too.

unless I misread. What do you think ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition change makes sense, not sure I understand what you mean about line 614?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line like 614 is just displaying the wrong case in the same fashion, only the error message changes compared to 665.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right 👍

Copy link
Member

@arnaud-lb arnaud-lb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

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.

ini_parse_quantity() accepts invalid arguments as valid
3 participants