Make pbump (internally) handle sizes bigger than MAX_INT. Fixes PR#33725 - thanks to Jonathan Wakely for the report

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@313031 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2017-09-12 15:00:43 +00:00
parent 60f8ad1b1d
commit 29149d3e35
6 changed files with 66 additions and 14 deletions

View File

@@ -186,7 +186,7 @@ strstreambuf::overflow(int_type __c)
}
setg(buf, buf + ninp, buf + einp);
setp(buf + einp, buf + new_size);
pbump(static_cast<int>(nout));
__pbump(nout);
__strmode_ |= __allocated;
}
*pptr() = static_cast<char>(__c);
@@ -282,7 +282,7 @@ strstreambuf::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmod
// min(pbase, newpos), newpos, epptr()
__off = epptr() - newpos;
setp(min(pbase(), newpos), epptr());
pbump(static_cast<int>((epptr() - pbase()) - __off));
__pbump((epptr() - pbase()) - __off);
}
__p = newoff;
}
@@ -312,7 +312,7 @@ strstreambuf::seekpos(pos_type __sp, ios_base::openmode __which)
// min(pbase, newpos), newpos, epptr()
off_type temp = epptr() - newpos;
setp(min(pbase(), newpos), epptr());
pbump(static_cast<int>((epptr() - pbase()) - temp));
__pbump((epptr() - pbase()) - temp);
}
__p = newoff;
}