From 2bfe91e4bd5a5678a3935c50b429cf33616cbca4 Mon Sep 17 00:00:00 2001 From: "Dongjia \"toka\" Zhang" Date: Mon, 19 Feb 2024 22:42:44 +0100 Subject: [PATCH] Fix a corner case where bitmap_size = 0 leads to panic (#1875) --- libafl/src/stages/calibrate.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libafl/src/stages/calibrate.rs b/libafl/src/stages/calibrate.rs index 6e08ff9952..7e2224cbf0 100644 --- a/libafl/src/stages/calibrate.rs +++ b/libafl/src/stages/calibrate.rs @@ -253,8 +253,8 @@ where .match_name::(&self.map_observer_name) .ok_or_else(|| Error::key_not_found("MapObserver not found".to_string()))?; - let bitmap_size = map.count_bytes(); - + let mut bitmap_size = map.count_bytes(); + bitmap_size = bitmap_size.max(1); // just don't make it 0 because we take log2 of it later. let psmeta = state .metadata_map_mut() .get_mut::()