mirror of
https://github.com/intel/llvm.git
synced 2026-01-17 14:48:27 +08:00
[lld][MachO] Always reserve space for the empty string in the mach-o symbol
table. The first entry in the MachO symbol table is always the empty string: make sure we reserve space for it, or we will overflow the symbol table by one byte. No test case - this manifests as an occasional memory error. In the near future I hope to set up a bot building and runnnig LLD with sanitizers - that should catch future instances of this issue. llvm-svn: 255178
This commit is contained in:
@@ -1269,7 +1269,7 @@ void MachOFileLayout::computeSymbolTableSizes() {
|
||||
_symbolTableSize = nlistSize * (_file.localSymbols.size()
|
||||
+ _file.globalSymbols.size()
|
||||
+ _file.undefinedSymbols.size());
|
||||
_symbolStringPoolSize = 0;
|
||||
_symbolStringPoolSize = 1; // Always reserve 1-byte for the empty string.
|
||||
for (const Symbol &sym : _file.localSymbols) {
|
||||
_symbolStringPoolSize += (sym.name.size()+1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user