We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d936479 commit 6257ffeCopy full SHA for 6257ffe
pch_mgr.cpp
@@ -107,7 +107,12 @@ const char* ResourceManager::realloc_buffer(const char *id,
107
size_t alloc_size = requireNullTerminate ? size + 1 : size;
108
buffer.resize(alloc_size);
109
buffer.assign(buf, buf + size);
110
- buffer.back() = '\0';
+ // The data in the buffer will be eventually passed to llvm::MemoryBufferMem
111
+ // ctor via argument of StringRef type. The Length of this StringRef will be
112
+ // = the 'size' argument of this function. There is an assert in
113
+ // llvm::MemoryBuffer::init checking that element *past the end* of the memory
114
+ // range passed via the ctor is '\0'. So we add it here.
115
+ buffer.push_back('\0');
116
117
return &buffer[0];
118
}
0 commit comments