]> 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 07:46:20 +0000 (08:46 +0100)
taglib/toolkit/tbytevector.cpp

index 5edbfbfe539c7d0816e45538917112a8350fbc6f..cb6a5a0fcf7f03b1f50e45bbf51ab04883bdba47 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();