summaryrefslogtreecommitdiff
path: root/include/streambuf
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2017-07-24 14:05:10 +0000
committerMarshall Clow <mclow.lists@gmail.com>2017-07-24 14:05:10 +0000
commit33e24e157eccb1a7ea09a7320a85b96380a25b88 (patch)
treec905bd1c9e3461f88d7be600cf83f332ecf138f8 /include/streambuf
parentbfa81b089ca50776e0b503e3e3edac8f0cfc55d6 (diff)
make sure that we don't call basic_streambuf::gbump with a value bigger than INT_MAX, since it only takes an int. Related to, but not quite the same as PR33725
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308880 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/streambuf')
-rw-r--r--include/streambuf3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/streambuf b/include/streambuf
index a10ce1bf5..f6182d64f 100644
--- a/include/streambuf
+++ b/include/streambuf
@@ -404,7 +404,8 @@ basic_streambuf<_CharT, _Traits>::xsgetn(char_type* __s, streamsize __n)
{
if (__ninp_ < __einp_)
{
- const streamsize __len = _VSTD::min(__einp_ - __ninp_, __n - __i);
+ const streamsize __len = _VSTD::min(static_cast<streamsize>(INT_MAX),
+ _VSTD::min(__einp_ - __ninp_, __n - __i));
traits_type::copy(__s, __ninp_, __len);
__s += __len;
__i += __len;