From 2fd8039f696ff5e34df182f2fdbc1ad2307388c6 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Thu, 17 Jun 2021 16:56:35 +0200 Subject: [PATCH] Fix max edges num count in pcguard --- libafl_targets/src/sancov_pcguard.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libafl_targets/src/sancov_pcguard.rs b/libafl_targets/src/sancov_pcguard.rs index a616104871..fac770f4c5 100644 --- a/libafl_targets/src/sancov_pcguard.rs +++ b/libafl_targets/src/sancov_pcguard.rs @@ -40,11 +40,11 @@ pub unsafe extern "C" fn __sanitizer_cov_trace_pc_guard_init(mut start: *mut u32 } while start < stop { - MAX_EDGES_NUM = MAX_EDGES_NUM.wrapping_add(1); - if MAX_EDGES_NUM >= EDGES_MAP.len() { - panic!("The number of edges reported by SanitizerCoverage exceed the size of the edges map ({}). Use the LIBAFL_EDGES_MAP_SIZE env to increase it at compile time.", EDGES_MAP.len()); - } *start = MAX_EDGES_NUM as u32; start = start.offset(1); + MAX_EDGES_NUM = MAX_EDGES_NUM.wrapping_add(1); + if MAX_EDGES_NUM > EDGES_MAP.len() { + panic!("The number of edges reported by SanitizerCoverage exceed the size of the edges map ({}). Use the LIBAFL_EDGES_MAP_SIZE env to increase it at compile time.", EDGES_MAP.len()); + } } }