[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - oox/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 22 13:43:41 UTC 2019


 oox/source/core/filterdetect.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit a2c94755d883ed807efa4a60302762cf4c6fbefe
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Oct 21 17:12:28 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Oct 22 15:42:56 2019 +0200

    Rather not put unencrypted doc in a tempfile
    
    Keep it in memory instead
    
    Change-Id: I25e5cb7183a4d192938110323e27f2f5d1d006fc
    Reviewed-on: https://gerrit.libreoffice.org/81253
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit bd3929da20b5a536b82b15af552864e7549f91ef)
    Reviewed-on: https://gerrit.libreoffice.org/81298
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index c5ea4b385849..4537e61a93c8 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -327,20 +327,23 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript
                 }
                 else
                 {
-                    // create temporary file for unencrypted package
-                    Reference<XStream> xTempFile( TempFile::create(mxContext), UNO_QUERY_THROW );
+                    // create MemoryStream for unencrypted package - rather not put this in a tempfile
+                    Reference<XStream> const xTempStream(
+                        mxContext->getServiceManager()->createInstanceWithContext(
+                            "com.sun.star.comp.MemoryStream", mxContext),
+                        UNO_QUERY_THROW);
 
                     // if decryption was unsuccessful (corrupted file or any other reason)
-                    if (!aDecryptor.decrypt(xTempFile))
+                    if (!aDecryptor.decrypt(xTempStream))
                     {
                         rMediaDescriptor[ MediaDescriptor::PROP_ABORTED() ] <<= true;
                     }
                     else
                     {
                         // store temp file in media descriptor to keep it alive
-                        rMediaDescriptor.setComponentDataEntry( "DecryptedPackage", Any( xTempFile ) );
+                        rMediaDescriptor.setComponentDataEntry( "DecryptedPackage", Any( xTempStream ) );
 
-                        Reference<XInputStream> xDecryptedInputStream = xTempFile->getInputStream();
+                        Reference<XInputStream> xDecryptedInputStream = xTempStream->getInputStream();
                         if( lclIsZipPackage( mxContext, xDecryptedInputStream ) )
                             return xDecryptedInputStream;
                     }


More information about the Libreoffice-commits mailing list