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 | 0823c54889ad3a2bc15bf7d03ef3b9657e06c8e0 (patch) | |
tree | 6534ae3c87c81a8508bf7c7170267acb98e71497 /lib/Support | |
parent | f319d791c16d847f40dd27e9018f2a95423c14bb (diff) | |
download | external_llvm-0823c54889ad3a2bc15bf7d03ef3b9657e06c8e0.zip external_llvm-0823c54889ad3a2bc15bf7d03ef3b9657e06c8e0.tar.gz external_llvm-0823c54889ad3a2bc15bf7d03ef3b9657e06c8e0.tar.bz2 |
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
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/raw_ostream.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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 @@ 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. |