Skip to content

Commit ddca08d

Browse files
committed
jv_parse: let decNumberFromString/strtod complex nans as a NaN
Before this patch (when using decNumber), "Nan123" was parsed as a NaN, only if the first n was uppercase.
1 parent 19453a6 commit ddca08d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/jv_parse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ static pfunc check_literal(struct jv_parser* p) {
514514
case 'f': pattern = "false"; plen = 5; v = jv_false(); break;
515515
case 'n':
516516
// if it starts with 'n', it could be a literal "nan"
517-
if (p->tokenpos != 3) {
517+
if (p->tokenbuf[1] == 'u') {
518518
pattern = "null"; plen = 4; v = jv_null();
519519
}
520520
}

0 commit comments

Comments
 (0)