From ab7d0fcc0989e96f8e4e8b234ff61c3b0cc3aa64 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 6 May 2025 10:01:16 -0400 Subject: [PATCH] fix: oob(!!) in CCHash.bytes --- src/core/CCHash.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/CCHash.ml b/src/core/CCHash.ml index 87415fb1..9ab06afc 100644 --- a/src/core/CCHash.ml +++ b/src/core/CCHash.ml @@ -101,7 +101,7 @@ let max_len_b_ = 128 let bytes (x : bytes) = let h = ref fnv_offset_basis in - for i = 0 to min max_len_b_ (Bytes.length x) do + for i = 0 to min max_len_b_ (Bytes.length x-1) do (h := Int64.(mul !h fnv_prime)); let byte = Char.code (Bytes.unsafe_get x i) in h := Int64.(logxor !h (of_int byte))