From 1f3d883f73472098cfa77c35873c52ce6552b311 Mon Sep 17 00:00:00 2001 From: Andrew Cassidy Date: Sun, 9 Jun 2024 23:25:54 -0700 Subject: [PATCH] Fix crash on macos macos has no minimum memory address, so this causes issues. Also used nullptr since 0x0 is a perfectly cromulent memory address (implementation defined). --- src/nvcore/Debug.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/nvcore/Debug.h b/src/nvcore/Debug.h index 4aca31b8..fc606319 100644 --- a/src/nvcore/Debug.h +++ b/src/nvcore/Debug.h @@ -167,8 +167,12 @@ namespace nv { inline bool isValidPtr(const void * ptr) { #if NV_CPU_X86_64 || POSH_CPU_PPC64 || NV_CPU_AARCH64 - if (ptr == NULL) return true; - if (reinterpret_cast(ptr) < 0x10000ULL) return false; + if (ptr == nullptr) return true; + // MACH_VM_MIN_ADDRESS == 0 + # ifndef __MACH__ + if (reinterpret_cast(ptr) < 0x10000ULL) return false; + #endif + if (reinterpret_cast(ptr) >= 0x000007FFFFFEFFFFULL) return false; #else if (reinterpret_cast(ptr) == 0xcccccccc) return false;