If cont.size() is 0, the expression &_contentPool[result] has undefined

behaivior because it indexes past the end of _contentPool.

llvm-svn: 149427
This commit is contained in:
Michael J. Spencer 2012-01-31 21:46:05 +00:00
parent b2bd733593
commit 846fe662ba
1 changed files with 1 additions and 2 deletions

View File

@ -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;
}