summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2016-03-22 22:51:03 +0000
committerPete Cooper <peter_cooper@apple.com>2016-03-22 22:51:03 +0000
commit8e1b9a17a692d428eeb16c0189ccbbaa741b366d (patch)
tree4b2734e00834943e30876d304e9426ec15e3f076 /lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
parentcd46960e6b93f07995e378534690c8ce3245fd53 (diff)
downloadbcm5719-llvm-8e1b9a17a692d428eeb16c0189ccbbaa741b366d.tar.gz
bcm5719-llvm-8e1b9a17a692d428eeb16c0189ccbbaa741b366d.zip
Don't memcpy from a null source. Found by UBSan
llvm-svn: 264114
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
index 34c48a500b9..03e081ababb 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
@@ -1066,6 +1066,8 @@ void MachOFileLayout::appendSymbols(const std::vector<Symbol> &symbols,
}
void MachOFileLayout::writeFunctionStartsInfo() {
+ if (!_functionStartsSize)
+ return;
memcpy(&_buffer[_startOfFunctionStarts], _file.functionStarts.data(),
_functionStartsSize);
}
OpenPOWER on IntegriCloud