diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2016-06-29 15:26:13 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2016-06-29 15:26:13 +0000 |
commit | 2556b769ecfcffd4d279c28b60e36ea6d2a434ac (patch) | |
tree | 8bfa66daa2f63980d62afdb074107e25eb5689f5 /libcxx/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp | |
parent | 832d0420781083009f758e01f1df59e4a00003b9 (diff) | |
download | bcm5719-llvm-2556b769ecfcffd4d279c28b60e36ea6d2a434ac.tar.gz bcm5719-llvm-2556b769ecfcffd4d279c28b60e36ea6d2a434ac.zip |
[libcxx] Fix a bug in strstreambuf::overflow.
The end pointer should point to one past the end of the newly allocated
buffer.
rdar://problem/24265174
Differential Revision: http://reviews.llvm.org/D20334
llvm-svn: 274132
Diffstat (limited to 'libcxx/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp')
-rw-r--r-- | libcxx/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libcxx/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp b/libcxx/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp new file mode 100644 index 00000000000..2336eb051ea --- /dev/null +++ b/libcxx/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <strstream> + +// class strstreambuf + +// int overflow(int c); + +#include <iostream> +#include <string> +#include <strstream> + +int main(int, char const **argv) { + std::ostrstream oss; + std::string s; + + for (int i = 0; i < 4096; ++i) + s.push_back((i % 16) + 'a'); + + oss << s << std::ends; + std::cout << oss.str(); + oss.freeze(false); + + return 0; +} |