package/source/zippackage/ZipPackageStream.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e22f1a2993d1c675ed8017090d1557d74d8b2917
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Sep 17 11:47:05 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Sep 18 11:39:00 2024 +0200

    package: tweak password fallback in ZipPackageStream::getDataStream()
    
    Fallbacks are only useful if an existing file is imported.
    
    It looks like it might have been possible to hit this case by storing a
    new document as ODF 1.1, and that sets m_bIsEncrypted but not
    m_oImportedAlgorithms (as Mike Kaganski pointed out), haven't tried it.
    
    Change-Id: Ia82c2e43372f50aa4e7ad9c2c62878986295c815
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173551
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/package/source/zippackage/ZipPackageStream.cxx 
b/package/source/zippackage/ZipPackageStream.cxx
index bd6bdf4cd74d..19017a11748f 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -1016,7 +1016,8 @@ uno::Reference< io::XInputStream > SAL_CALL 
ZipPackageStream::getDataStream()
             // note: due to SHA1 check this fallback is only done for
             // * ODF 1.2 files written by OOo < 3.4beta / LO < 3.5
             // * ODF 1.1/OOoXML files written by any version
-            if ( m_rZipPackage.GetStartKeyGenID() == 
xml::crypto::DigestID::SHA1 )
+            if (m_oImportedAlgorithms
+                && m_oImportedAlgorithms->nImportedStartKeyAlgorithm == 
xml::crypto::DigestID::SHA1)
             {
                 SAL_WARN("package", "ZipPackageStream::getDataStream(): SHA1 
mismatch, trying fallbacks...");
                 try

Reply via email to