[llvm-commits] [llvm] r58199 - /llvm/trunk/lib/Support/raw_ostream.cpp

Chris Lattner sabre at nondot.org
Sun Oct 26 12:20:48 PDT 2008


Author: lattner
Date: Sun Oct 26 14:20:47 2008
New Revision: 58199

URL: http://llvm.org/viewvc/llvm-project?rev=58199&view=rev
Log:
fix PR2953, an off-by-one error handling formatted i/o. 
Thanks to Török Edwin for the awesome reduced testcase.

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=58199&r1=58198&r2=58199&view=diff

==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Sun Oct 26 14:20:47 2008
@@ -175,7 +175,7 @@
     unsigned BytesUsed = Fmt.print(&V[0], NextBufferSize);
     
     // If BytesUsed fit into the vector, we win.
-    if (BytesUsed < NextBufferSize)
+    if (BytesUsed <= NextBufferSize)
       return write(&V[0], BytesUsed);
     
     // Otherwise, try again with a new size.





More information about the llvm-commits mailing list