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 memcpy data to the target variables to avoid unalignment
issues

Fixes #24272

Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Tom Cosgrove <[email protected]>
(Merged from openssl/openssl#24276)
  • Loading branch information
nhorman authored and t8m committed Apr 30, 2024
1 parent 2d29a8a commit c04901b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fuzz/hashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
memcpy(&keyval, &buf[1], sizeof(uint16_t));

/*
* 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];
memcpy(&valptr->value, &buf[3], sizeof(uint64_t));
/*
* do the insert/replace
*/
Expand Down

0 comments on commit c04901b

Please sign in to comment.