diff options
Diffstat (limited to 'fuzz/xml_parsebuffer_fuzzer.c')
| -rw-r--r-- | fuzz/xml_parsebuffer_fuzzer.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/fuzz/xml_parsebuffer_fuzzer.c b/fuzz/xml_parsebuffer_fuzzer.c index 38b9981b0b50..a854f6706396 100644 --- a/fuzz/xml_parsebuffer_fuzzer.c +++ b/fuzz/xml_parsebuffer_fuzzer.c @@ -35,7 +35,8 @@ #endif // 16-byte deterministic hash key. -static unsigned char hash_key[16] = "FUZZING IS FUN!"; +static unsigned char hash_key_1[16] = "FUZZING IS FUN?"; +static unsigned char hash_key_2[16] = "FUZZING IS FUN!"; static void XMLCALL start(void *userData, const XML_Char *name, const XML_Char **atts) { @@ -60,8 +61,14 @@ may_stop_character_handler(void *userData, const XML_Char *s, int len) { static void ParseOneInput(XML_Parser p, const uint8_t *data, size_t size) { // Set the hash salt using siphash to generate a deterministic hash. - struct sipkey *key = sip_keyof(hash_key); - XML_SetHashSalt(p, (unsigned long)siphash24(data, size, key)); + // The salt is 16 bytes and siphash24 produces 8, so the input is hashed + // under two keys. + const uint64_t first = siphash24(data, size, sip_keyof(hash_key_1)); + const uint64_t second = siphash24(data, size, sip_keyof(hash_key_2)); + uint8_t entropy[16]; + memcpy(entropy, &first, sizeof(first)); + memcpy(entropy + sizeof(first), &second, sizeof(second)); + XML_SetHashSalt16Bytes(p, entropy); (void)sip24_valid; XML_SetUserData(p, p); |
