]> granicus.if.org Git - taglib/commitdiff
Avoid uint overflow in case the length + index is over UINT_MAX
authorLukáš Lalinský <lalinsky@gmail.com>
Sat, 10 Mar 2012 07:46:20 +0000 (08:46 +0100)
committerLukáš Lalinský <lalinsky@gmail.com>
Sat, 10 Mar 2012 08:13:04 +0000 (09:13 +0100)
taglib/toolkit/tbytevector.cpp

index 9fb77b123db616157f46426002c15232b31ec433..e5dcf1d866a977408fba359f0f442238189b2291 100644 (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();