summaryrefslogtreecommitdiffstats
path: root/lld
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2012-01-31 21:46:05 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2012-01-31 21:46:05 +0000
commit846fe662ba0a532fbf865e317b187802861fca17 (patch)
tree81f5f67996a64c9178146a51ece46a149b5aa88d /lld
parentb2bd7335938ad5c82543ec312548cb56dfe99e4a (diff)
downloadbcm5719-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.cpp3
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;
}
OpenPOWER on IntegriCloud