[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
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 2556b769ecfcffd4d279c28b60e36ea6d2a434ac
diff --git a/src/strstream.cpp b/src/strstream.cpp
index 83702fc..0e2d7ff 100644
--- a/src/strstream.cpp
+++ b/src/strstream.cpp
@@ -175,7 +175,6 @@
         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 @@
                 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;
     }