Fix main heap cookie on macOS

This commit is contained in:
daan 2019-07-02 12:53:53 -07:00
parent aeff1db32b
commit 4326bda2c7

View file

@ -364,7 +364,9 @@ void mi_process_init(void) mi_attr_noexcept {
_mi_heap_main.thread_id = _mi_thread_id();
_mi_verbose_message("process init: 0x%zx\n", _mi_heap_main.thread_id);
uintptr_t random = _mi_random_init(_mi_heap_main.thread_id) ^ (uintptr_t)h;
#ifndef __APPLE
_mi_heap_main.cookie = (uintptr_t)&_mi_heap_main ^ random;
#endif
_mi_heap_main.random = _mi_random_shuffle(random);
#if (MI_DEBUG)
_mi_verbose_message("debug level : %d\n", MI_DEBUG);