[compiler-rt] [asan] Use InternalMmapVector for error_message_buffer, reallocate wh… (PR #77488)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 00:04:19 PST 2024


================
@@ -42,17 +41,15 @@ void AppendToErrorMessageBuffer(const char *buffer) {
   Lock l(&error_message_buf_mutex);
   if (!error_message_buffer) {
     error_message_buffer =
-      (char*)MmapOrDieQuietly(kErrorMessageBufferSize, __func__);
-    error_message_buffer_pos = 0;
+        new (GetGlobalLowLevelAllocator()) InternalMmapVector<char>();
+    error_message_buffer->reserve(kErrorMessageBufferSize);
+    error_message_buffer->push_back('\0');
----------------
vitalybuka wrote:

why do we need \0?

https://github.com/llvm/llvm-project/pull/77488


More information about the llvm-commits mailing list