reject trailing whitespace after hex literals unless allowed - #307
Open
Ramya-9353 wants to merge 1 commit into
Open
reject trailing whitespace after hex literals unless allowed#307Ramya-9353 wants to merge 1 commit into
Ramya-9353 wants to merge 1 commit into
Conversation
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.
Repro: with ALLOW_HEX alone, StringToDouble("0x12 ") returns 18 and processed_characters_count 5; with ALLOW_HEX_FLOATS alone, "0x3p0 " returns 3 with processed_characters_count 5 of 6. The decimal and octal paths return junk_string_value for "12 " and "012 " under the same flags.
Cause: RadixStringToIeee (main digit loop and the 53-bit overflow branch) and the tail of IsHexFloatString still end the literal with the V8-era !AdvanceToNonspace test, which predates ALLOW_TRAILING_SPACES, so whitespace is swallowed whether or not the flag is set.
Fix: pass allow_trailing_spaces into both and only skip trailing whitespace when it is set, matching the decimal path; behaviour with ALLOW_TRAILING_SPACES or ALLOW_TRAILING_JUNK is unchanged. Regression cases added to the existing StringToDoubleHexString flag blocks.