From 6534adf395c5eed5fb410b14783b3c58237eeea8 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Mon, 15 Jul 2024 12:19:08 +1200 Subject: [PATCH] Initialize `ctrl_` with its correct size (#653) 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_); }