Bump fuzzlib hash size from 32 to 64

Also have json_fuzzer choose at most one of the BACKSLASH_X quirks.
This commit is contained in:
Nigel Tao committed 2020-08-10 22:56:47 +10:00
1 parent 28ef6a7862
commit c7b90256b3
5 files changed
+42 -28

No files matched your search

+6 -6
View File
@@ -218,7 +218,7 @@ fuzz_one_token(wuffs_base__token t,
}
uint64_t //
buffer_limit(uint32_t hash_6_bits, uint64_t min, uint64_t max) {
buffer_limit(uint64_t hash_6_bits, uint64_t min, uint64_t max) {
uint64_t n;
if (hash_6_bits < 0x20) {
n = min + hash_6_bits;
@@ -234,14 +234,14 @@ buffer_limit(uint32_t hash_6_bits, uint64_t min, uint64_t max) {
}
const char* //
fuzz_complex(wuffs_base__io_buffer* full_src, uint32_t hash_24_bits) {
fuzz_complex(wuffs_base__io_buffer* full_src, uint64_t hash_56_bits) {
uint64_t tok_limit = buffer_limit(
hash_24_bits & 0x3F, WUFFS_CBOR__DECODER_DST_TOKEN_BUFFER_LENGTH_MIN_INCL,
hash_56_bits & 0x3F, WUFFS_CBOR__DECODER_DST_TOKEN_BUFFER_LENGTH_MIN_INCL,
TOK_BUFFER_ARRAY_SIZE);
uint32_t hash_18_bits = hash_24_bits >> 6;
uint64_t hash_50_bits = hash_56_bits >> 6;
uint64_t src_limit =
buffer_limit(hash_18_bits & 0x3F,
buffer_limit(hash_50_bits & 0x3F,
WUFFS_CBOR__DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL, 4096);
// ----
@@ -391,7 +391,7 @@ fuzz_simple(wuffs_base__io_buffer* full_src) {
}
const char* //
fuzz(wuffs_base__io_buffer* full_src, uint32_t hash) {
fuzz(wuffs_base__io_buffer* full_src, uint64_t hash) {
// Send 99.6% of inputs to fuzz_complex and the remainder to fuzz_simple. The
// 0xA5 constant is arbitrary but non-zero. If the hash function maps the
// empty input to 0, this still sends the empty input to fuzz_complex.