[llvm-commits] [llvm] r127853 - /llvm/trunk/lib/Support/MemoryBuffer.cpp
Rafael Espindola
rafael.espindola at gmail.com
Thu Mar 17 19:55:51 PDT 2011
Author: rafael
Date: Thu Mar 17 21:55:51 2011
New Revision: 127853
URL: http://llvm.org/viewvc/llvm-project?rev=127853&view=rev
Log:
Check RequiresNullTerminator first, or we might read from an invalid address.
Modified:
llvm/trunk/lib/Support/MemoryBuffer.cpp
Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=127853&r1=127852&r2=127853&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
+++ llvm/trunk/lib/Support/MemoryBuffer.cpp Thu Mar 17 21:55:51 2011
@@ -48,7 +48,7 @@
/// 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;
More information about the llvm-commits
mailing list