Core: StringStream ExcLimit exception fixed for big chunks of data

git-svn-id: svn://ultimatepp.org/upp/trunk@11833 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-03-12 15:11:34 +00:00
parent ead7b2d896
commit e841fdffba

View file

@ -884,10 +884,10 @@ void StringStream::_Put(const void *d, dword sz)
SetWriteMode();
if(ptr + sz >= wrlim) {
size_t p = ptr - buffer;
if(limit != INT_MAX && p + sz > (size_t)limit)
throw LimitExc();
if(p + sz >= INT_MAX)
Panic("2GB StringStream limit exceeded");
if(p + sz > (size_t)limit)
throw LimitExc();
int len = (int32)max((int64)128, min((int64)limit, max(2 * GetSize(), GetSize() + sz)));
wdata.SetLength(len);
SetWriteBuffer();