diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp --- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp @@ -1185,7 +1185,9 @@ uptr GetMaxUserVirtualAddress() { static uptr max_vm = GetTaskInfoMaxAddress(); if (max_vm != 0) { - return max_vm - 1; + const uptr ret_value = max_vm - 1; + CHECK_LE(ret_value, SANITIZER_MMAP_RANGE_SIZE) + return ret_value; } // xnu cannot provide vm address limit