throw earlier on broken zip streams

Change-Id: I0de705b4c6a9176e98baed21b2cd960d4d091563
This commit is contained in:
Caolán McNamara
2012-08-28 13:05:47 +01:00
parent 8c205bfccd
commit e2f3312ea2

View File

@@ -78,6 +78,10 @@ XUnbufferedStream::XUnbufferedStream(
mnZipSize = maEntry.nSize;
mnZipEnd = maEntry.nMethod == DEFLATED ? maEntry.nOffset + maEntry.nCompressedSize : maEntry.nOffset + maEntry.nSize;
}
if (mnZipSize < 0)
throw ZipIOException(OUString("The stream seems to be broken!"), uno::Reference< XInterface >());
sal_Bool bHaveEncryptData = ( rData.is() && rData->m_aSalt.getLength() && rData->m_aInitVector.getLength() && rData->m_nIterationCount != 0 ) ? sal_True : sal_False;
sal_Bool bMustDecrypt = ( nStreamMode == UNBUFF_STREAM_DATA && bHaveEncryptData && bIsEncrypted ) ? sal_True : sal_False;