package/source/zippackage/ZipPackageStream.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
New commits: commit ce5c683383f9c4f42cde203fedcfda8e924a4c77 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Sep 17 11:47:05 2024 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Sep 20 21:03:14 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> (cherry picked from commit e22f1a2993d1c675ed8017090d1557d74d8b2917) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173503 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index f5a1ecf6a3ee..9cfbb0a295f9 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -1029,7 +1029,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