Skip to content

Fix: reject non-conformant JSON numbers in parse_number - #1134

Open
YikunWei-dev wants to merge 1 commit into
DaveGamble:masterfrom
YikunWei-dev:fix/strict-number-parsing
Open

YikunWei-dev wants to merge 1 commit into
DaveGamble:masterfrom
YikunWei-dev:fix/strict-number-parsing

Conversation

@YikunWei-dev

Copy link
Copy Markdown

parse_number accepted inputs that are not valid JSON numbers per RFC 8259, such as a leading '+', a '.' without following digits, leading zeros (e.g. "0123"), a bare '-', or an exponent without digits (e.g. "1e+"). Add an is_valid_json_number() check that enforces the JSON number grammar and rejects these.

Conformant numbers (including exponents with an optional sign) are unaffected. Add unit tests covering the previously-accepted cases.

parse_number accepted inputs that are not valid JSON numbers per
RFC 8259, such as a leading '+', a '.' without following digits,
leading zeros (e.g. "0123"), a bare '-', or an exponent without
digits (e.g. "1e+"). Add an is_valid_json_number() check that
enforces the JSON number grammar and rejects these.

Conformant numbers (including exponents with an optional sign) are
unaffected. Add unit tests covering the previously-accepted cases.
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