From 722c48df084ae1470283e296cf6bc8bbcdb7a711 Mon Sep 17 00:00:00 2001 From: Eduard Voronkin Date: Sun, 30 Mar 2025 21:18:44 -0700 Subject: [PATCH] fix invalid page detection --- include/mimalloc/internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/mimalloc/internal.h b/include/mimalloc/internal.h index 0a1ebfc0..d9f0c08c 100644 --- a/include/mimalloc/internal.h +++ b/include/mimalloc/internal.h @@ -573,7 +573,8 @@ static inline mi_page_t* _mi_checked_ptr_page(const void* p) { size_t sub_idx; const size_t idx = _mi_page_map_index(p, &sub_idx); mi_page_t** const sub = _mi_page_map[idx]; - if mi_unlikely(sub == NULL) return (mi_page_t*)&_mi_page_empty; + if mi_unlikely (sub == NULL || *sub == NULL) + return (mi_page_t *)&_mi_page_empty; return sub[sub_idx]; }