Fix crash in pthread_tsd_cleanup on macOS ARM64 (#1177)
Fixes #1177
On macOS ARM64, freeing memory during thread exit can crash when thread_local C++ objects are involved. The issue is that _mi_checked_ptr_page checks for sub == NULL but not for sub[sub_idx] == NULL - commit 515047b fixed the first case but missed the second.
This adds the missing NULL check so both cases return _mi_page_empty consistently.
@microsoft-github-policy-service agree company="Microsoft"
@austenstone I'm digging further, but this change trips the UB sanitizer on my ARM Mac when landed against the dev3 branch. I see you've landed it against the dev3-cdb branch, which I can't find documented anywhere, so that might be my problem.
@austenstone I'm digging further, but this change trips the UB sanitizer on my ARM Mac when landed against the dev3 branch. I see you've landed it against the dev3-cdb branch, which I can't find documented anywhere, so that might be my problem.
Yes, it is not recommended to use the dev3-cdb branch. I believe this issue is not present for the dev3 branch (or dev2 or dev1) (at least, I cannot reproduce it). Let me know if switching to dev3 fixes your probem?