Index: compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp +++ compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp @@ -133,16 +133,12 @@ } } -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wframe-larger-than=" -#endif bool WinSymbolizerTool::SymbolizePC(uptr addr, SymbolizedStack *frame) { InitializeDbgHelpIfNeeded(); // See https://docs.microsoft.com/en-us/windows/win32/debug/retrieving-symbol-information-by-address - char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(CHAR)]; - PSYMBOL_INFO symbol = (PSYMBOL_INFO)buffer; + InternalMmapVector buffer(sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(CHAR)); + PSYMBOL_INFO symbol = (PSYMBOL_INFO)&buffer[0]; symbol->SizeOfStruct = sizeof(SYMBOL_INFO); symbol->MaxNameLen = MAX_SYM_NAME; DWORD64 offset = 0; @@ -166,9 +162,6 @@ // Otherwise, try llvm-symbolizer. return got_fileline; } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif const char *WinSymbolizerTool::Demangle(const char *name) { CHECK(is_dbghelp_initialized); Index: compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp +++ compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp @@ -43,15 +43,14 @@ trace_buffer[0] = pc; } -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wframe-larger-than=" -#endif void BufferedStackTrace::UnwindSlow(uptr pc, void *context, u32 max_depth) { CHECK(context); CHECK_GE(max_depth, 2); - CONTEXT ctx = *(CONTEXT *)context; - STACKFRAME64 stack_frame; + InternalMmapVector ctx_buf(1); + CONTEXT &ctx = ctx_buf[0]; + ctx = *(CONTEXT *)context; + InternalMmapVector stack_frame_buf(1); + STACKFRAME64 &stack_frame = stack_frame_buf[0]; memset(&stack_frame, 0, sizeof(stack_frame)); InitializeDbgHelpIfNeeded(); @@ -78,9 +77,6 @@ trace_buffer[size++] = (uptr)stack_frame.AddrPC.Offset; } } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif #endif // #if !SANITIZER_GO #endif // SANITIZER_WINDOWS Index: compiler-rt/lib/sanitizer_common/sanitizer_win.cpp =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_win.cpp +++ compiler-rt/lib/sanitizer_common/sanitizer_win.cpp @@ -590,7 +590,7 @@ // IMAGE_FILE_HEADER // IMAGE_OPTIONAL_HEADER // Seek to e_lfanew and read all that data. - char buf[4 + sizeof(IMAGE_FILE_HEADER) + sizeof(IMAGE_OPTIONAL_HEADER)]; + InternalMmapVector buf(4 + sizeof(IMAGE_FILE_HEADER) + sizeof(IMAGE_OPTIONAL_HEADER)); if (::SetFilePointer(fd, dos_header.e_lfanew, nullptr, FILE_BEGIN) == INVALID_SET_FILE_POINTER) return 0; @@ -615,10 +615,6 @@ return (uptr)pe_header->ImageBase; } -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wframe-larger-than=" -#endif void ListOfModules::init() { clearOrInit(); HANDLE cur_process = GetCurrentProcess(); @@ -650,14 +646,14 @@ continue; // Get the UTF-16 path and convert to UTF-8. - wchar_t modname_utf16[kMaxPathLength]; + InternalMmapVector modname_utf16(kMaxPathLength); int modname_utf16_len = - GetModuleFileNameW(handle, modname_utf16, kMaxPathLength); + GetModuleFileNameW(handle, &modname_utf16[0], kMaxPathLength); if (modname_utf16_len == 0) modname_utf16[0] = '\0'; - char module_name[kMaxPathLength]; + InternalMmapVector module_name(kMaxPathLength); int module_name_len = - ::WideCharToMultiByte(CP_UTF8, 0, modname_utf16, modname_utf16_len + 1, + ::WideCharToMultiByte(CP_UTF8, 0, &modname_utf16[0], modname_utf16_len + 1, &module_name[0], kMaxPathLength, NULL, NULL); module_name[module_name_len] = '\0'; @@ -671,18 +667,15 @@ uptr preferred_base = GetPreferredBase(&module_name[0]); uptr adjusted_base = base_address - preferred_base; - LoadedModule cur_module; - cur_module.set(module_name, adjusted_base); + modules_.push_back(LoadedModule()); + LoadedModule &cur_module = modules_.back(); + cur_module.set(&module_name[0], adjusted_base); // We add the whole module as one single address range. cur_module.addAddressRange(base_address, end_address, /*executable*/ true, /*writable*/ true); - modules_.push_back(cur_module); } UnmapOrDie(hmodules, modules_buffer_size); } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif void ListOfModules::fallbackInit() { clear(); } @@ -1057,15 +1050,15 @@ return 0; // Get the UTF-16 path and convert to UTF-8. - wchar_t binname_utf16[kMaxPathLength]; + InternalMmapVector binname_utf16(kMaxPathLength); int binname_utf16_len = - GetModuleFileNameW(NULL, binname_utf16, ARRAY_SIZE(binname_utf16)); + GetModuleFileNameW(NULL, &binname_utf16[0], kMaxPathLength); if (binname_utf16_len == 0) { buf[0] = '\0'; return 0; } int binary_name_len = ::WideCharToMultiByte( - CP_UTF8, 0, binname_utf16, binname_utf16_len, buf, buf_len, NULL, NULL); + CP_UTF8, 0, &binname_utf16[0], binname_utf16_len, buf, buf_len, NULL, NULL); if ((unsigned)binary_name_len == buf_len) --binary_name_len; buf[binary_name_len] = '\0';