fix encrypted parallel zip saving (tdf#134332)

ZipOutputEntryBase::processDeflated() was calling isDeflaterFinished()
to find out whether to finalize and dispose m_xCipherContext.
With ZipOutputEntryParallel this was always true, so the context
was disposed after the first call. That was originally correct, because
originally processDeflated() was called just once at the very end, but
353d4528b8 changed to calling it several
times.

Change-Id: I1e4a0c887e4ba7ac7b20fa315169eaa911335fde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98625
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
Luboš Luňák
2020-07-13 12:02:59 +02:00
parent 30ee17749a
commit 08161f8535
2 changed files with 5 additions and 1 deletions

View File

@@ -139,6 +139,7 @@ class ZipOutputEntryParallel final : public ZipOutputEntryBase
{
sal_Int64 totalIn;
sal_Int64 totalOut;
bool finished;
public:
ZipOutputEntryParallel(
const css::uno::Reference< css::io::XOutputStream >& rxOutStream,

View File

@@ -358,6 +358,7 @@ ZipOutputEntryParallel::ZipOutputEntryParallel(
: ZipOutputEntryBase(rxOutput, rxContext, rEntry, pStream, bEncrypt, true)
, totalIn(0)
, totalOut(0)
, finished(false)
{
}
@@ -381,6 +382,7 @@ void ZipOutputEntryParallel::writeStream(const uno::Reference< io::XInputStream
void ZipOutputEntryParallel::finishDeflater()
{
// ThreadedDeflater is called synchronously in one call, so nothing to do here.
finished = true;
}
sal_Int64 ZipOutputEntryParallel::getDeflaterTotalIn() const
@@ -397,11 +399,12 @@ void ZipOutputEntryParallel::deflaterReset()
{
totalIn = 0;
totalOut = 0;
finished = false;
}
bool ZipOutputEntryParallel::isDeflaterFinished() const
{
return true;
return finished;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */