mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 00:52:18 +01:00
Raise std/json's max number length from 49 to 99
This commit is contained in:
1 parent
6b161af654
commit
83ae50ce9b
2 files changed
+10
-2
No files matched your search
@@ -19367,7 +19367,7 @@ wuffs_json__decoder__decode_digits(wuffs_json__decoder* self,
|
|||||||
if ((v_c < 48) || (57 < v_c)) {
|
if ((v_c < 48) || (57 < v_c)) {
|
||||||
goto label_0_break;
|
goto label_0_break;
|
||||||
}
|
}
|
||||||
if (v_n >= 49) {
|
if (v_n >= 99) {
|
||||||
v_n |= 512;
|
v_n |= 512;
|
||||||
goto label_0_break;
|
goto label_0_break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -690,7 +690,15 @@ pri func decoder.decode_digits!(src: base.io_reader, n: base.u32[..= 0xFF]) base
|
|||||||
if (c < 0x30) or (0x39 < c) {
|
if (c < 0x30) or (0x39 < c) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if n >= 49 {
|
// Cap the maximum supported number length at an arbitrary value, 99.
|
||||||
|
// The caller's src.data.len should therefore be at least 100.
|
||||||
|
//
|
||||||
|
// An example of a JSON number that is 81 bytes long is:
|
||||||
|
// https://github.com/nst/JSONTestSuite/blob/master/test_parsing/y_number_double_close_to_zero.json
|
||||||
|
//
|
||||||
|
// Note that 99 (in hex, 0x63) is less than 0x80, so we can use 0x80 as
|
||||||
|
// a flag bit in func decoder.decode_number.
|
||||||
|
if n >= 99 {
|
||||||
n |= 0x200
|
n |= 0x200
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user