Repository navigation
Conversation
jorgsowa
reviewed
Dec 5, 2026
jorgsowa
left a comment
Contributor
There was a problem hiding this comment.
Isn't UINT_MAX still too high? yyleng goes into int len in zend_ini_copy_typed_value() and zend_ini_escape_string(), so tokens over 2 GiB still abort:
parse_ini_file() has the same truncation in zend_ini_open_file_for_scanning().
The INT_MAX check added to parse_ini_string() for bug #55622 set the return value without returning, and its size_t subtraction wrapped for strings longer than INT_MAX, so it never rejected anything. The scanner takes the buffer length as unsigned int, truncating files and strings longer than UINT_MAX, and passes token lengths to int parameters in zend_ini_copy_typed_value() and zend_ini_escape_string(), which go negative for tokens longer than INT_MAX. Reject input longer than INT_MAX in zend_ini_open_file_for_scanning() and zend_ini_prepare_string_for_scanning(), which covers parse_ini_file() and parse_ini_string() alike, and drop the dead check.
iliaal
force-pushed
the
fix/parse-ini-string-length-guard
branch
from
December 6, 2026 13:14
46c2e2f to
1e48110
Compare
Member
Author
|
Right, moved the check into both scanner entry points with an INT_MAX limit, so |
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.
The INT_MAX check in
parse_ini_string()set the return value without returning, and itssize_tsubtraction wrapped above INT_MAX, so it never rejected anything. The INI scanner takes the buffer length asunsigned intand passes token lengths tointparameters, so reject input longer than INT_MAX in both scanner entry points instead, which coversparse_ini_file()as well. No test, since triggering it needs a 2 GiB input.