libreoffice: update to 24.8.4.2
[oi-userland.git] / components / runtime / openjdk-23 / patches / tribblix-demangle1.patch
blobfe9cc9d73d9fab9974c42a1569607bbf3fec09c6
1 --- a/src/hotspot/os/solaris/decoder_solaris.cpp.orig Tue Apr 14 19:31:07 2020
2 +++ b/src/hotspot/os/solaris/decoder_solaris.cpp Tue Apr 14 20:07:38 2020
3 @@ -22,11 +22,24 @@
5 */
7 +#include "jvm.h"
8 #include "utilities/decoder_elf.hpp"
10 -#include <demangle.h>
11 +#include <cxxabi.h>
13 bool ElfDecoder::demangle(const char* symbol, char *buf, int buflen) {
14 - return !cplus_demangle(symbol, buf, (size_t)buflen);
15 + int status;
16 + char* result;
17 + size_t size = (size_t)buflen;
18 + // Don't pass buf to __cxa_demangle. In case of the 'buf' is too small,
19 + // __cxa_demangle will call system "realloc" for additional memory, which
20 + // may use different malloc/realloc mechanism that allocates 'buf'.
21 + if ((result = abi::__cxa_demangle(symbol, NULL, NULL, &status)) != NULL) {
22 + jio_snprintf(buf, buflen, "%s", result);
23 + // call c library's free
24 + ::free(result);
25 + return true;
26 + }
27 + return false;