Skip to content

Commit

Permalink
Fix alignment errors in hashtable fuzzer
Browse files Browse the repository at this point in the history
we extract several values (uint16_t and uint64_t from the fuzzer buff
passed in, but they weren't aligned on 2 and 8 byte boundaries.  Adjust
the fuzzer to use the proper offsets

Fixes #24272
  • Loading branch information
nhorman committed Apr 26, 2024
1 parent 933f57d commit 5ba221c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fuzz/hashtable.c
Expand Up @@ -133,7 +133,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
* 1 byte to detect the operation to preform, 2 bytes
* for the lookup key, and 8 bytes of value
*/
if (len < 11) {
if (len < 20) {
skipped_values++;
return -1;
}
Expand All @@ -142,7 +142,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
* parse out our operation flags and key
*/
op_flags = buf[0];
keyval = *((uint16_t *)&buf[1]);
keyval = *((uint16_t *)&buf[2]);

/*
* Initialize our key
Expand Down Expand Up @@ -177,7 +177,7 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
rc_prediction = 0;
}

valptr->value = *(uint64_t *)&buf[3];
valptr->value = *(uint64_t *)&buf[8];
/*
* do the insert/replace
*/
Expand Down

0 comments on commit 5ba221c

Please sign in to comment.