From 9fb3e61e8994febb564f111e26591b0cfdccfa43 Mon Sep 17 00:00:00 2001 From: Nicholas Lederer Date: Tue, 25 Feb 2020 06:15:09 -0800 Subject: [PATCH] fix issue with stacktrace_windows not allocating sufficient memory for SYMBOL_INFO struct (#334) --- src/stacktrace_windows.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stacktrace_windows.cpp b/src/stacktrace_windows.cpp index 5c24794..9271549 100644 --- a/src/stacktrace_windows.cpp +++ b/src/stacktrace_windows.cpp @@ -110,7 +110,7 @@ namespace { DWORD64 displacement64; DWORD displacement; - char symbol_buffer[sizeof(SYMBOL_INFO) + 256]; + char symbol_buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME]; SYMBOL_INFO *symbol = reinterpret_cast(symbol_buffer); symbol->SizeOfStruct = sizeof(SYMBOL_INFO); symbol->MaxNameLen = MAX_SYM_NAME; @@ -120,7 +120,7 @@ namespace { std::string lineInformation; std::string callInformation; if (SymFromAddr(GetCurrentProcess(), addr, &displacement64, symbol)) { - callInformation.append(" ").append({std::string(symbol->Name), symbol->NameLen}); + callInformation.append(" ").append(std::string(symbol->Name, symbol->NameLen)); if (SymGetLineFromAddr64(GetCurrentProcess(), addr, &displacement, &line)) { lineInformation.append("\t").append(line.FileName).append(" L: "); lineInformation.append(std::to_string(line.LineNumber));