From: Vsevolod Stakhov Date: Wed, 5 Jan 2022 13:51:17 +0000 (+0000) Subject: [Minor] Init xxhash3 state properly X-Git-Tag: 3.2~128 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b7813c46b74dae41901b74af7f3ca3830d1f285;p=thirdparty%2Frspamd.git [Minor] Init xxhash3 state properly --- diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c index 41f13ed73e..3caf364e65 100644 --- a/src/libcryptobox/cryptobox.c +++ b/src/libcryptobox/cryptobox.c @@ -1519,9 +1519,10 @@ void rspamd_cryptobox_fast_hash_init (rspamd_cryptobox_fast_hash_state_t *st, guint64 seed) { - XXH3_state_t *rst = (XXH3_state_t *)st->opaque; + XXH3_state_t *xst = (XXH3_state_t *)st->opaque; st->type = RSPAMD_CRYPTOBOX_XXHASH3; - XXH3_64bits_reset_withSeed (rst, seed); + XXH3_INITSTATE (xst); + XXH3_64bits_reset_withSeed (xst, seed); } void @@ -1540,6 +1541,7 @@ rspamd_cryptobox_fast_hash_init_specific (rspamd_cryptobox_fast_hash_state_t *st } case RSPAMD_CRYPTOBOX_XXHASH64: { XXH64_state_t *xst = (XXH64_state_t *) st->opaque; + memset(xst, 0, sizeof(*xst)); st->type = RSPAMD_CRYPTOBOX_XXHASH64; XXH64_reset (xst, seed); break; @@ -1547,6 +1549,7 @@ rspamd_cryptobox_fast_hash_init_specific (rspamd_cryptobox_fast_hash_state_t *st case RSPAMD_CRYPTOBOX_XXHASH32: { XXH32_state_t *xst = (XXH32_state_t *) st->opaque; + memset(xst, 0, sizeof(*xst)); st->type = RSPAMD_CRYPTOBOX_XXHASH32; XXH32_reset (xst, seed); break; @@ -1554,6 +1557,7 @@ rspamd_cryptobox_fast_hash_init_specific (rspamd_cryptobox_fast_hash_state_t *st case RSPAMD_CRYPTOBOX_XXHASH3: { XXH3_state_t *xst = (XXH3_state_t *) st->opaque; + XXH3_INITSTATE(xst); st->type = RSPAMD_CRYPTOBOX_XXHASH3; XXH3_64bits_reset_withSeed (xst, seed); break;