[llvm-commits] CVS: llvm/include/llvm/Bytecode/Primitives.h
Chris Lattner
lattner at cs.uiuc.edu
Tue May 6 13:46:01 PDT 2003
Changes in directory llvm/include/llvm/Bytecode:
Primitives.h updated: 1.7 -> 1.8
---
Log message:
Fix memory corruption problem
---
Diffs of the changes:
Index: llvm/include/llvm/Bytecode/Primitives.h
diff -u llvm/include/llvm/Bytecode/Primitives.h:1.7 llvm/include/llvm/Bytecode/Primitives.h:1.8
--- llvm/include/llvm/Bytecode/Primitives.h:1.7 Tue Sep 17 18:48:02 2002
+++ llvm/include/llvm/Bytecode/Primitives.h Tue May 6 13:45:02 2003
@@ -163,7 +163,8 @@
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);
More information about the llvm-commits
mailing list