summaryrefslogtreecommitdiff
path: root/src/strstream.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2016-06-29 15:26:13 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2016-06-29 15:26:13 +0000
commit70bf1c2280d514792b4bc6035c4685e82da79645 (patch)
tree54f6fa62986f11910bdc3e301f09f3f1f8ff58bc /src/strstream.cpp
parent05d5c05fe814afe772b9081f4c3068ec01f77000 (diff)
downloadlibcxx-70bf1c2280d514792b4bc6035c4685e82da79645.tar.gz
[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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/strstream.cpp')
-rw-r--r--src/strstream.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/strstream.cpp b/src/strstream.cpp
index 83702fc72..0e2d7ff21 100644
--- a/src/strstream.cpp
+++ b/src/strstream.cpp
@@ -175,7 +175,6 @@ strstreambuf::overflow(int_type __c)
ptrdiff_t ninp = gptr() - eback();
ptrdiff_t einp = egptr() - eback();
ptrdiff_t nout = pptr() - pbase();
- ptrdiff_t eout = epptr() - pbase();
if (__strmode_ & __allocated)
{
if (__pfree_)
@@ -184,7 +183,7 @@ strstreambuf::overflow(int_type __c)
delete [] eback();
}
setg(buf, buf + ninp, buf + einp);
- setp(buf + einp, buf + einp + eout);
+ setp(buf + einp, buf + new_size);
pbump(static_cast<int>(nout));
__strmode_ |= __allocated;
}