[llvm-commits] [llvm] r138705 - /llvm/trunk/lib/Support/MemoryObject.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sat Aug 27 00:45:46 PDT 2011
Author: d0k
Date: Sat Aug 27 02:45:46 2011
New Revision: 138705
URL: http://llvm.org/viewvc/llvm-project?rev=138705&view=rev
Log:
Report failure if there are less bytes than requested in a MemoryObject.
Before we just left the remaining bytes uninitialized. This is another step in making llvm valgrind-clean again.
Modified:
llvm/trunk/lib/Support/MemoryObject.cpp
Modified: llvm/trunk/lib/Support/MemoryObject.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryObject.cpp?rev=138705&r1=138704&r2=138705&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryObject.cpp (original)
+++ llvm/trunk/lib/Support/MemoryObject.cpp Sat Aug 27 02:45:46 2011
@@ -19,8 +19,11 @@
uint64_t* copied) const {
uint64_t current = address;
uint64_t limit = getBase() + getExtent();
-
- while (current - address < size && current < limit) {
+
+ if (current + size > limit)
+ return -1;
+
+ while (current - address < size) {
if (readByte(current, &buf[(current - address)]))
return -1;
More information about the llvm-commits
mailing list