From c6d9b47762d58281a0fc1f4b077f22c30b73d661 Mon Sep 17 00:00:00 2001 From: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:09:00 +0000 Subject: [PATCH] Fix: `_sz_find_3byte_serial` overflow Closes #177 Co-authored-by: Aleksandr Slepnev Co-authored-by: Aleksandr Slepnev <84568706+Keynib@users.noreply.github.com> --- include/stringzilla/stringzilla.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/stringzilla/stringzilla.h b/include/stringzilla/stringzilla.h index b38da970..47d6e603 100644 --- a/include/stringzilla/stringzilla.h +++ b/include/stringzilla/stringzilla.h @@ -2129,7 +2129,7 @@ SZ_INTERNAL sz_cptr_t _sz_find_3byte_serial(sz_cptr_t h, sz_size_t h_length, sz_ sz_u64_vec_t matches0_vec, matches1_vec, matches2_vec, matches3_vec, matches4_vec; sz_u64_vec_t n_vec; n_vec.u64 = 0; - n_vec.u8s[0] = n[0], n_vec.u8s[1] = n[1], n_vec.u8s[2] = n[2], n_vec.u8s[3] = n[3]; + n_vec.u8s[0] = n[0], n_vec.u8s[1] = n[1], n_vec.u8s[2] = n[2]; n_vec.u64 *= 0x0000000001000001ull; // broadcast // This code simulates hyper-scalar execution, analyzing 8 offsets at a time using three 64-bit words.