From 2bfc72e65e8a55b3517fe12bc247a587ef12696f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 26 Oct 2008 19:20:47 +0000 Subject: [PATCH] =?UTF-8?q?fix=20PR2953,=20an=20off-by-one=20error=20handl?= =?UTF-8?q?ing=20formatted=20i/o.=20Thanks=20to=20T=C3=B6r=C3=B6k=20Edwin?= =?UTF-8?q?=20for=20the=20awesome=20reduced=20testcase.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit llvm-svn: 58199 --- llvm/lib/Support/raw_ostream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index a4c293660b0b..8c704cb47146 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -175,7 +175,7 @@ raw_ostream &raw_ostream::operator<<(const format_object_base &Fmt) { 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.