From e64233e203e2a8c8a087405c7de7e76f6216da11 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Wed, 3 Apr 2024 13:27:19 +0200 Subject: [PATCH] LLMP: Fix page-size where allocated message is larger than the current map (#1997) --- libafl_bolts/src/llmp.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libafl_bolts/src/llmp.rs b/libafl_bolts/src/llmp.rs index 6137ddb92e..8d0276e30f 100644 --- a/libafl_bolts/src/llmp.rs +++ b/libafl_bolts/src/llmp.rs @@ -1158,6 +1158,12 @@ where (*page).size_total ); + // For future allocs, keep track of the maximum (aligned) alloc size we used + (*page).max_alloc_size = max( + (*page).max_alloc_size, + size_of::() + buf_len_padded, + ); + // We need enough space for the current page size_used + payload + padding if (*page).size_used + size_of::() + buf_len_padded + EOP_MSG_SIZE > (*page).size_total @@ -1189,12 +1195,6 @@ where (*_llmp_next_msg_ptr(ret)).tag = LLMP_TAG_UNSET; (*ret).tag = LLMP_TAG_UNINITIALIZED; - // For future allocs, keep track of the maximum (aligned) alloc size we used - (*page).max_alloc_size = max( - (*page).max_alloc_size, - size_of::() + buf_len_padded, - ); - self.has_unsent_message = true; Some(ret)