sc/source/filter/excel/excel.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit b3223e1f236e450fcbb71c415dc64dbd10a7ae0a
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Fri Feb 16 23:56:52 2024 +0900
Commit:     Miklos Vajna <[email protected]>
CommitDate: Thu Feb 29 11:52:58 2024 +0100

    sc: Handle xls documents with unknown DRM encryption better
    
    If we can't decrypt the document, don't set the SotStorage to
    an empty SvRef. It is possible the document contains a "fallback"
    un-encrypted document, which we can show. This is typical for some
    Excel add-ons, which encrypt the document, but also add a part
    that is un-encrypted to write the instructions on how to get the
    add-on.
    
    Change-Id: I6079786b1d0dce3a819a70e057699d0a461a5be5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163511
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    (cherry picked from commit 1e1072afa3726266f83d7ef8895ed406580a3450)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163535
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index 8420cc696a90..c92ef75d6998 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -183,7 +183,9 @@ ErrCode ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& 
rMedium, ScDocument*
         tools::SvRef<SotStorageStream> xDRMStrm = 
ScfTools::OpenStorageStreamRead(xRootStrg, " DRMContent");
         if (xDRMStrm.is())
         {
-            xRootStrg = lcl_DRMDecrypt(rMedium, xRootStrg, aNewStorageStrm);
+            auto pDecryptedStorage = lcl_DRMDecrypt(rMedium, xRootStrg, 
aNewStorageStrm);
+            if (pDecryptedStorage)
+                xRootStrg = pDecryptedStorage;
         }
 
         // try to open the "Book" stream

Reply via email to