diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-01-31 21:46:05 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-01-31 21:46:05 +0000 |
commit | 846fe662ba0a532fbf865e317b187802861fca17 (patch) | |
tree | 81f5f67996a64c9178146a51ece46a149b5aa88d /lld | |
parent | b2bd7335938ad5c82543ec312548cb56dfe99e4a (diff) | |
download | bcm5719-llvm-846fe662ba0a532fbf865e317b187802861fca17.tar.gz bcm5719-llvm-846fe662ba0a532fbf865e317b187802861fca17.zip |
If cont.size() is 0, the expression &_contentPool[result] has undefined
behaivior because it indexes past the end of _contentPool.
llvm-svn: 149427
Diffstat (limited to 'lld')
-rw-r--r-- | lld/lib/Core/NativeWriter.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lld/lib/Core/NativeWriter.cpp b/lld/lib/Core/NativeWriter.cpp index d5fa925d3aa..2880a5940d1 100644 --- a/lld/lib/Core/NativeWriter.cpp +++ b/lld/lib/Core/NativeWriter.cpp @@ -128,8 +128,7 @@ private: return 0; uint32_t result = _contentPool.size(); llvm::ArrayRef<uint8_t> cont = atom.rawContent(); - _contentPool.insert(_contentPool.end(), cont.size(), 0); - memcpy(&_contentPool[result], cont.data(), cont.size()); + _contentPool.insert(_contentPool.end(), cont.begin(), cont.end()); return result; } |