http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47921

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-02-28 
12:43:41 UTC ---
something like this (untested)

--- include/std/streambuf.orig  2011-02-28 12:40:44.559350898 +0000
+++ include/std/streambuf       2011-02-28 12:32:20.445685621 +0000
@@ -38,6 +38,7 @@

 #include <bits/c++config.h>
 #include <iosfwd>
+#include <limits>
 #include <bits/localefwd.h>
 #include <bits/ios_base.h>
 #include <bits/cpp_type_traits.h>
--- include/bits/streambuf.tcc.orig     2011-02-28 12:40:35.554301020 +0000
+++ include/bits/streambuf.tcc  2011-02-28 12:42:30.761788519 +0000
@@ -91,6 +91,11 @@
              traits_type::copy(this->pptr(), __s, __len);
              __ret += __len;
              __s += __len;
+             while (__len > std::numeric_limits<int>::max())
+               {
+                 this->pbump(std::numeric_limits<int>::max());
+                 __len -= std::numeric_limits<int>::max();
+               }
              this->pbump(__len);
            }

--- src/strstream.cc.orig       2011-02-28 12:40:25.373244770 +0000
+++ src/strstream.cc    2011-02-28 12:42:10.945712166 +0000
@@ -161,6 +161,11 @@
              }

            setp(buf, buf + new_size);
+           while (old_size > INT_MAX)
+           {
+             this->pbump(INT_MAX);
+             old_size -= INT_MAX;
+           }
            pbump(old_size);

            if (reposition_get)

Reply via email to