diff options
author | Chris Lattner <sabre@nondot.org> | 2003-05-06 18:45:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-05-06 18:45:02 +0000 |
commit | 6a4e6341f23934cd0a6d5883cc9a7518e54f70b4 (patch) | |
tree | 1f1d0370990769b281740547a277f61896bf4d0c | |
parent | 15b55e20cc3ca89d77b3e5c2833b569eb33aa4f9 (diff) |
Fix memory corruption problem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6003 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Bytecode/Primitives.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/llvm/Bytecode/Primitives.h b/include/llvm/Bytecode/Primitives.h index 31399a0658..b72bbf2967 100644 --- a/include/llvm/Bytecode/Primitives.h +++ b/include/llvm/Bytecode/Primitives.h @@ -163,7 +163,8 @@ static inline void output(unsigned i, std::deque<unsigned char> &Out, if (pos == -1) Out.insert(Out.end(), (unsigned char*)&i, (unsigned char*)&i+4); else - *(unsigned*)&Out[pos] = i; + // This cannot use block copy because deques are not guaranteed contiguous! + std::copy((unsigned char*)&i, 4+(unsigned char*)&i, Out.begin()+pos); #else if (pos == -1) { // Be endian clean, little endian is our friend Out.push_back((unsigned char)i); |