Reject NaN with payload while parsing JSON
This commit drops support for parsing NaN with payload in JSON like `NaN123` and fixes CVE-2024-53427. Other JSON extensions like `NaN` and `Infinity` are still supported. Fixes #3023, fixes #3196, fixes #3246.
This commit is contained in:
1 parent
a8ce2ff09a
commit
a09a4dfd55
3 files changed
+15
-11
No files matched your search
@@ -585,6 +585,11 @@ static jv jvp_literal_number_new(const char * literal) {
|
||||
return JV_INVALID;
|
||||
}
|
||||
if (decNumberIsNaN(&n->num_decimal)) {
|
||||
// Reject NaN with payload.
|
||||
if (n->num_decimal.digits > 1 || *n->num_decimal.lsu != 0) {
|
||||
jv_mem_free(n);
|
||||
return JV_INVALID;
|
||||
}
|
||||
jv_mem_free(n);
|
||||
return jv_number(NAN);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user