diff options
author | Graham Linden <graham@lindenlab.com> | 2018-06-07 23:06:43 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-06-07 23:06:43 +0100 |
commit | 3b6bf06ee1c88b4c7fb617358d34c69529b11878 (patch) | |
tree | 069b06e7068d46602a3c3f0a5e6d2f06aac3cd06 /indra/llcommon/llerror.cpp | |
parent | 1fe32c16fb299c1eb6a47e6860198f07b0c806c4 (diff) | |
parent | 88da45148eeae26e1bae11bf3c948796e0f7cfdb (diff) |
MAINT-8724 fix crash in libc++abi demangling on OSX 10.14 Mojave
Diffstat (limited to 'indra/llcommon/llerror.cpp')
-rw-r--r-- | indra/llcommon/llerror.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index f31a054139..29de79dc64 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -249,23 +249,13 @@ namespace LLError { #ifdef __GNUC__ // GCC: type_info::name() returns a mangled class name,st demangle - - static size_t abi_name_len = 100; - static char* abi_name_buf = (char*)malloc(abi_name_len); - // warning: above is voodoo inferred from the GCC manual, - // do NOT change - - int status; - // We don't use status, and shouldn't have to pass apointer to it - // but gcc 3.3 libstc++'s implementation of demangling is broken - // and fails without. - - char* name = abi::__cxa_demangle(mangled, - abi_name_buf, &abi_name_len, &status); - // this call can realloc the abi_name_buf pointer (!) - - return name ? name : mangled; - + // passing nullptr, 0 forces allocation of a unique buffer we can free + // fixing MAINT-8724 on OSX 10.14 + int status = -1; + char* name = abi::__cxa_demangle(mangled, nullptr, 0, &status); + std::string result(name ? name : mangled); + free(name); + return result; #elif LL_WINDOWS // DevStudio: type_info::name() includes the text "class " at the start |