commit | 8e1b9a17a692d428eeb16c0189ccbbaa741b366d | [log] [tgz] |
---|---|---|
author | Pete Cooper <peter_cooper@apple.com> | Tue Mar 22 22:51:03 2016 +0000 |
committer | Pete Cooper <peter_cooper@apple.com> | Tue Mar 22 22:51:03 2016 +0000 |
tree | 4b2734e00834943e30876d304e9426ec15e3f076 | |
parent | cd46960e6b93f07995e378534690c8ce3245fd53 [diff] [blame] |
Don't memcpy from a null source. Found by UBSan llvm-svn: 264114
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp index 34c48a5..03e081a 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
@@ -1066,6 +1066,8 @@ } void MachOFileLayout::writeFunctionStartsInfo() { + if (!_functionStartsSize) + return; memcpy(&_buffer[_startOfFunctionStarts], _file.functionStarts.data(), _functionStartsSize); }