fix PR2953, an off-by-one error handling formatted i/o.
Thanks to Török Edwin for the awesome reduced testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58199 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index a4c2936..8c704cb 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -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.