cid#1615990 silence Overflowed integer argument
Change-Id: I37ff85c8d6363bd1e9fb1097dc107bca2ad73738 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171926 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
parent
898594dc5d
commit
4551356827
1 changed files with 3 additions and 5 deletions
|
@ -1304,15 +1304,13 @@ sal_Int32 ZipFile::readCEN()
|
|||
if (nCenLen < nTotal * CENHDR) // prevent overflow with ZIP_MAXENTRIES
|
||||
throw ZipException(u"invalid END header (bad entry count)"_ustr );
|
||||
|
||||
if (SAL_MAX_INT32 < nCenLen)
|
||||
{
|
||||
if (nCenLen > SAL_MAX_INT32 || nCenLen < 0)
|
||||
throw ZipException(u"central directory too big"_ustr);
|
||||
}
|
||||
|
||||
aGrabber.seek(nCenPos);
|
||||
Sequence < sal_Int8 > aCENBuffer ( nCenLen );
|
||||
Sequence<sal_Int8> aCENBuffer(nCenLen);
|
||||
sal_Int64 nRead = aGrabber.readBytes ( aCENBuffer, nCenLen );
|
||||
if ( static_cast < sal_Int64 > ( nCenLen ) != nRead )
|
||||
if (nCenLen != nRead)
|
||||
throw ZipException (u"Error reading CEN into memory buffer!"_ustr );
|
||||
|
||||
MemoryByteGrabber aMemGrabber(aCENBuffer);
|
||||
|
|
Loading…
Reference in a new issue