fix invalid pointer detection in release mode (issue #1051 and #1053)

This commit is contained in:
Daan 2025-03-31 10:54:12 -07:00
parent a73c3cc7e2
commit 71b3e16171
4 changed files with 10 additions and 23 deletions

View file

@ -566,14 +566,14 @@ static inline size_t _mi_page_map_index(const void* p, size_t* sub_idx) {
static inline mi_page_t* _mi_unchecked_ptr_page(const void* p) {
size_t sub_idx;
const size_t idx = _mi_page_map_index(p, &sub_idx);
return _mi_page_map[idx][sub_idx];
return _mi_page_map[idx][sub_idx]; // NULL if p==NULL
}
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) return NULL;
return sub[sub_idx];
}