aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/MemoryBuffer.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-03-18 02:55:51 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-03-18 02:55:51 +0000
commit49ab1207df3d7d5a4bb3b3e3dcc611e78d262714 (patch)
treeac0560c2257cb51e025ec60473a32b3de46ec5a5 /lib/Support/MemoryBuffer.cpp
parentb4b8b0cc901ce41a0fb025885897d022eab390f2 (diff)
Check RequiresNullTerminator first, or we might read from an invalid address.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/MemoryBuffer.cpp')
-rw-r--r--lib/Support/MemoryBuffer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp
index 63a1c54a40..c08e91a382 100644
--- a/lib/Support/MemoryBuffer.cpp
+++ b/lib/Support/MemoryBuffer.cpp
@@ -48,7 +48,7 @@ MemoryBuffer::~MemoryBuffer() { }
/// memory, memory that we know is already null terminated.
void MemoryBuffer::init(const char *BufStart, const char *BufEnd,
bool RequiresNullTerminator) {
- assert((BufEnd[0] == 0 || !RequiresNullTerminator) &&
+ assert((!RequiresNullTerminator || BufEnd[0] == 0) &&
"Buffer is not null terminated!");
BufferStart = BufStart;
BufferEnd = BufEnd;