[llvm-commits] [llvm] r78926 - /llvm/trunk/lib/Support/raw_ostream.cpp
Dan Gohman
gohman at apple.com
Thu Aug 13 11:38:15 PDT 2009
Author: djg
Date: Thu Aug 13 13:38:15 2009
New Revision: 78926
URL: http://llvm.org/viewvc/llvm-project?rev=78926&view=rev
Log:
Add an assert to check copy_to_buffer's precondition.
Modified:
llvm/trunk/lib/Support/raw_ostream.cpp
Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=78926&r1=78925&r2=78926&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Thu Aug 13 13:38:15 2009
@@ -222,6 +222,8 @@
}
void raw_ostream::copy_to_buffer(const char *Ptr, size_t Size) {
+ assert(Size <= OutBufEnd - OutBufCur && "Buffer overrun!");
+
// Handle short strings specially, memcpy isn't very good at very short
// strings.
switch (Size) {
More information about the llvm-commits
mailing list