Avoid uint overflow in case the length + index is over UINT_MAX

This commit is contained in:
Lukáš Lalinský 2012-03-10 08:46:20 +01:00
parent 258ae751b5
commit 110cac8429

View File

@ -363,7 +363,7 @@ ByteVector ByteVector::mid(uint index, uint length) const
ConstIterator endIt;
if(length < 0xffffffff && length + index < size())
if(length < size() - index)
endIt = d->data.begin() + index + length;
else
endIt = d->data.end();