Skip to content

Commit

Permalink
jv_parse: let decNumberFromString/strtod complex nans as a NaN
Browse files Browse the repository at this point in the history
Before this patch (when using decNumber), "Nan123" was parsed as a NaN,
only if the first n was uppercase.
  • Loading branch information
emanuele6 committed Dec 12, 2023
1 parent 19453a6 commit ddca08d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/jv_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ static pfunc check_literal(struct jv_parser* p) {
case 'f': pattern = "false"; plen = 5; v = jv_false(); break;
case 'n':
// if it starts with 'n', it could be a literal "nan"
if (p->tokenpos != 3) {
if (p->tokenbuf[1] == 'u') {
pattern = "null"; plen = 4; v = jv_null();
}
}
Expand Down

0 comments on commit ddca08d

Please sign in to comment.