diff options
author | Neil Horman <nhorman@openssl.org> | 2024-04-26 12:38:38 -0400 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-04-30 12:53:51 +0200 |
commit | c04901be78768eb698d575d0b046940a5cb2aa5b (patch) | |
tree | 4bf773d3c37f8ca922465a656005b769771e85a9 /fuzz | |
parent | 2d29a8a7e8ef42050d2b08ca8cec9e4d9f0a0bb7 (diff) |
Fix alignment errors in hashtable fuzzer
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 <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/24276)
Diffstat (limited to 'fuzz')
-rw-r--r-- | fuzz/hashtable.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fuzz/hashtable.c b/fuzz/hashtable.c index 64a736d815..35cf9c8f3b 100644 --- a/fuzz/hashtable.c +++ b/fuzz/hashtable.c @@ -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 @@ -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 */ |