[lld] r264114 - Don't memcpy from a null source. Found by UBSan
Pete Cooper via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 22 15:51:03 PDT 2016
Author: pete
Date: Tue Mar 22 17:51:03 2016
New Revision: 264114
URL: http://llvm.org/viewvc/llvm-project?rev=264114&view=rev
Log:
Don't memcpy from a null source. Found by UBSan
Modified:
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp?rev=264114&r1=264113&r2=264114&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp Tue Mar 22 17:51:03 2016
@@ -1066,6 +1066,8 @@ void MachOFileLayout::appendSymbols(cons
}
void MachOFileLayout::writeFunctionStartsInfo() {
+ if (!_functionStartsSize)
+ return;
memcpy(&_buffer[_startOfFunctionStarts], _file.functionStarts.data(),
_functionStartsSize);
}
More information about the llvm-commits
mailing list