Repository navigation
preserve octal state for all-zero integer prefixes under ALLOW_OCTALS - #331
Open
jdymitarai wants to merge 1 commit into
Open
jdymitarai wants to merge 1 commit into
jdymitarai wants to merge 1 commit into
Conversation
When StringToDoubleConverter is configured with ALLOW_OCTALS, strings starting with multiple zeros such as 00.5 or 00e2 were resetting octal to false because significant_digits was zero. This allowed decimal points and exponential suffixes to slip through into decimal parsing instead of being rejected or handled as trailing junk. We now track whether multiple leading zeros were consumed in the integer part, preserving octal mode when the integer part consists entirely of zeros while allowing single zero prefixes like 0.5 to parse as decimal numbers. In addition, parsing_done safely maps an empty octal buffer to SignedZero(sign) without triggering assertion failures. Regression test cases covering both strict and trailing junk modes for multi-zero and single-zero inputs have been added to test-conversions.cc, with all cctest test suites passing cleanly on Linux x86_64.
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.
When StringToDoubleConverter is configured with ALLOW_OCTALS, strings starting with multiple zeros such as "00.5" or "00e2" were erroneously resetting octal to false because significant_digits remained zero. This allowed decimal points and exponential suffixes to slip through into decimal parsing instead of being rejected or handled as trailing junk.
We now track whether multiple leading zeros were consumed in the integer part, preserving octal mode when the integer part consists entirely of zeros while allowing single zero prefixes like "0.5" to parse as decimal numbers. In addition, parsing_done safely maps an empty octal buffer to SignedZero(sign) without triggering assertion failures.
Regression test cases covering both strict and trailing junk modes for multi-zero and single-zero inputs have been added to test-conversions.cc. All 9 cctest test suites have been verified and pass cleanly on Linux x86_64.
Resolves #330.