always use non-flat map in secure mode and validate pointers passed to free

This commit is contained in:
daanx 2025-05-21 16:32:06 -07:00
parent 09c2b7fdcf
commit 8a66ae818a
5 changed files with 13 additions and 3 deletions

View file

@ -89,9 +89,11 @@ int main(void) {
CHECK_BODY("malloc-free-null") {
mi_free(NULL);
};
#if MI_INTPTR_BITS >= 64
CHECK_BODY("malloc-free-invalid-low") {
mi_free((void*)(MI_ZU(0x0000000003990080))); // issue #1087
};
#endif
CHECK_BODY("calloc-overflow") {
// use (size_t)&mi_calloc to get some number without triggering compiler warnings
result = (mi_calloc((size_t)&mi_calloc,SIZE_MAX/1000) == NULL);