From dd3d25816db428cf0d9c46d810ae19d043271795 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Tue, 2 Jul 2024 02:02:54 +0000 Subject: [PATCH] Initialize `ctrl_` with its correct size This bug was caught by MSAN when the hashmap is serialized. --- lib/parallel_hashmap/parallel_hashmap/phmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parallel_hashmap/parallel_hashmap/phmap.h b/lib/parallel_hashmap/parallel_hashmap/phmap.h index e9c2cc0bb..22b3cc887 100644 --- a/lib/parallel_hashmap/parallel_hashmap/phmap.h +++ b/lib/parallel_hashmap/parallel_hashmap/phmap.h @@ -2097,7 +2097,7 @@ class raw_hash_set // Reset all ctrl bytes back to kEmpty, except the sentinel. void reset_ctrl() { - std::memset(ctrl_, kEmpty, capacity_ + Group::kWidth); + std::memset(ctrl_, kEmpty, capacity_ + Group::kWidth + 1); ctrl_[capacity_] = kSentinel; SanitizerPoisonMemoryRegion(slots_, sizeof(slot_type) * capacity_); }