Skip to content

reject trailing whitespace after hex literals unless allowed - #307

Open
Ramya-9353 wants to merge 1 commit into
google:masterfrom
Ramya-9353:hex-trailing-whitespace
Open

reject trailing whitespace after hex literals unless allowed#307
Ramya-9353 wants to merge 1 commit into
google:masterfrom
Ramya-9353:hex-trailing-whitespace

Conversation

@Ramya-9353

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant