summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-03-20 20:54:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-03-21 08:54:44 +0000
commit52cc0c8f05d40db6d076c13f8b8d6d9453ec8930 (patch)
treeb9a19e68f770d81a26a69d821d8ee3adcd7b9848 /package
parent16b6b45e8ca1e727694a52525cf35782c0d69978 (diff)
coverity#982784 Unintentional integer overflow
Change-Id: Ib50e0987adf419ecdd569fc5dd5c8b2b1e246e2f
Diffstat (limited to 'package')
-rw-r--r--package/source/zipapi/ZipFile.cxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 72551857dbdf..83505e2dc0f8 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -1072,16 +1072,15 @@ sal_Int32 ZipFile::getCRC( sal_Int64 nOffset, sal_Int64 nSize )
Sequence < sal_Int8 > aBuffer;
CRC32 aCRC;
- sal_Int32 nBlockSize = static_cast< sal_Int32 > (::std::min( nSize, static_cast< sal_Int64 >( 32000 ) ) );
+ sal_Int64 nBlockSize = ::std::min(nSize, static_cast< sal_Int64 >(32000));
aGrabber.seek( nOffset );
- for ( int ind = 0;
- aGrabber.readBytes( aBuffer, nBlockSize ) && ind * nBlockSize < nSize;
- ind++ )
+ for (sal_Int64 ind = 0;
+ aGrabber.readBytes( aBuffer, nBlockSize ) && ind * nBlockSize < nSize;
+ ++ind)
{
- sal_Int64 nLen = ::std::min( static_cast< sal_Int64 >( nBlockSize ),
- nSize - ind * nBlockSize );
- aCRC.updateSegment( aBuffer, 0, static_cast< sal_Int32 >( nLen ) );
+ sal_Int64 nLen = ::std::min(nBlockSize, nSize - ind * nBlockSize);
+ aCRC.updateSegment(aBuffer, 0, static_cast<sal_Int32>(nLen));
}
return aCRC.getValue();