diff options
author | Chris Lattner <sabre@nondot.org> | 2008-10-26 19:20:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-10-26 19:20:47 +0000 |
commit | 2bfc72e65e8a55b3517fe12bc247a587ef12696f (patch) | |
tree | a8dc0b0c49d60e4649b552a0a796f74d16c726e3 /llvm/lib/Support/raw_ostream.cpp | |
parent | 5cba81afb36d14546f80dbc60ca72a5ac873d2fe (diff) | |
download | bcm5719-llvm-2bfc72e65e8a55b3517fe12bc247a587ef12696f.tar.gz bcm5719-llvm-2bfc72e65e8a55b3517fe12bc247a587ef12696f.zip |
fix PR2953, an off-by-one error handling formatted i/o.
Thanks to Török Edwin for the awesome reduced testcase.
llvm-svn: 58199
Diffstat (limited to 'llvm/lib/Support/raw_ostream.cpp')
-rw-r--r-- | llvm/lib/Support/raw_ostream.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index a4c293660b0..8c704cb4714 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. |