[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/source

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 16 18:25:20 UTC 2020


 sw/source/filter/ww8/docxexport.cxx |   26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

New commits:
commit ac66e1319732139bb41f65b9755e70c8bc5ee3a4
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue Jul 21 16:23:29 2020 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Sep 16 20:24:41 2020 +0200

    tdf#131288 Chart: fix export of embedded xlsx
    
    To avoid exporting a broken DOCX, we have to seek
    the 'embeddingsStream', so we avoid to export an empty
    (0 Kb) embedded xlsx.
    Co-authored-by: Balázs Regényi
    
    Change-Id: I1723091aab3e2070f3db75ce866897e38021718d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99151
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit b115d4899d827f885f7d35ced4cb64d2385e3422)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99926
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 2a755d748aecd65d1a3d0c2685678a85472481cd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102766
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 7fed578100d1..7487ba6cb658 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -33,6 +33,7 @@
 #include <com/sun/star/xml/sax/XSAXSerializable.hpp>
 #include <com/sun/star/xml/sax/Writer.hpp>
 #include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
 #include <com/sun/star/sdb/CommandType.hpp>
 
 #include <oox/token/namespaces.hxx>
@@ -425,7 +426,7 @@ OString DocxExport::WriteOLEObject(SwOLEObj& rObject, OUString & io_rProgID)
 
     try
     {
-        ::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
+        comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
     }
     catch (uno::Exception const&)
     {
@@ -1445,24 +1446,11 @@ void DocxExport::WriteEmbeddings()
                                     contentType);
             try
             {
-                sal_Int32 nBufferSize = 512;
-                uno::Sequence< sal_Int8 > aDataBuffer(nBufferSize);
-                sal_Int32 nRead;
-                do
-                {
-                    nRead = embeddingsStream->readBytes( aDataBuffer, nBufferSize );
-                    if( nRead )
-                    {
-                        if( nRead < nBufferSize )
-                        {
-                            nBufferSize = nRead;
-                            aDataBuffer.realloc(nRead);
-                        }
-                        xOutStream->writeBytes( aDataBuffer );
-                    }
-                }
-                while( nRead );
-                xOutStream->flush();
+                // tdf#131288: the stream must be seekable for direct access
+                uno::Reference< io::XSeekable > xSeekable(embeddingsStream, uno::UNO_QUERY);
+                if (xSeekable)
+                    xSeekable->seek(0); // tdf#131288: a previous save could position it elsewhere
+                comphelper::OStorageHelper::CopyInputToOutput(embeddingsStream, xOutStream);
             }
             catch(const uno::Exception&)
             {


More information about the Libreoffice-commits mailing list