Add fuzz/c/std/json_fuzzer.c

This commit is contained in:
Nigel Tao committed 2020-03-01 12:01:42 +11:00
1 parent 6b29f32564
commit 21682f403f
6 files changed
+375 -2

No files matched your search

+4 -2
View File
@@ -30,7 +30,8 @@ pub struct decoder? implements base.token_decoder(
//
// Wuffs code does not have the capability to dynamically allocate memory,
// so the maximum depth is hard-coded at compile time. In this case, the
// maximum is 1024 (stack is 1024 bits or 128 bytes).
// maximum is 1024 (stack is 1024 bits or 128 bytes), also known as
// decoder_depth_max_incl.
//
// The [JSON spec](https://tools.ietf.org/html/rfc7159) clearly states, "an
// implementation may set limits on the maximum depth of nesting".
@@ -926,7 +927,8 @@ pri func decoder.decode_digits!(src: base.io_reader, n: base.u32[..= 0xFF]) base
break
}
// Cap the maximum supported number length at an arbitrary value, 99.
// The caller's src.data.len should therefore be at least 100.
// The caller's src.data.len should therefore be at least 100, also
// known as decoder_src_io_buffer_length_min_incl.
//
// 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