oox/source/core/filterbase.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2887ffbf240aa70330cb50bf810170cf9c896405
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Thu Mar 14 12:20:05 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Mar 14 15:33:15 2024 +0100

    tdf#160192: fix crash when trying to overwrite file in RO dir+lock file
    
    Bug exposed with:
    5259ab8104cfba60c40748ed0cd59d93df038c5b
    sfx2 store: create temp files next to local files
    
    bt:
    6  0x00007faac67ad9b5 in 
sax_fastparser::FastSaxSerializer::FastSaxSerializer(com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>
 const&) (this=0x559f316f0e70, xOutputStream=empty uno::Reference)
        at sax/source/tools/fastserializer.cxx:68
    7  0x00007faac67c46e0 in 
sax_fastparser::FastSerializerHelper::FastSerializerHelper(com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>
 const&, bool)
        (this=0x559f31721400, xOutputStream=empty uno::Reference, 
bWriteHeader=true) at sax/source/tools/fshelper.cxx:30
    8  0x00007fa9bfa1b4cc in 
std::_Construct<sax_fastparser::FastSerializerHelper, 
com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>, bool 
const&>(sax_fastparser::FastSerializerHelper*, 
com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>&&, bool 
const&) (__p=0x559f31721400, __args=..., __args=@0x7ffecd609207: true)
        at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:119
    ...
    15 0x00007fa9bfa04087 in 
oox::core::XmlFilterBase::openFragmentStreamWithSerializer(rtl::OUString 
const&, rtl::OUString const&)
        (this=0x559f318ed5f0, rStreamName="docProps/core.xml", 
rMediaType="application/vnd.openxmlformats-package.core-properties+xml") at 
oox/source/core/xmlfilterbase.cxx:511
    16 0x00007fa9bfa04999 in 
oox::core::writeCoreProperties(oox::core::XmlFilterBase&, 
com::sun::star::uno::Reference<com::sun::star::document::XDocumentProperties> 
const&)
        (rSelf=..., xProperties=uno::Reference to ((anonymous 
namespace)::SfxDocumentMetaData *) 0x559f2d673e28) at 
oox/source/core/xmlfilterbase.cxx:645
    17 0x00007fa9bfa047c2 in 
oox::core::XmlFilterBase::exportDocumentProperties(com::sun::star::uno::Reference<com::sun::star::document::XDocumentProperties>
 const&, bool)
        (this=0x559f318ed5f0, xProperties=uno::Reference to ((anonymous 
namespace)::SfxDocumentMetaData *) 0x559f2d673e28, 
bSecurityOptOpenReadOnly=false) at oox/source/core/xmlfilterbase.cxx:981
    18 0x00007fa9bee21bd4 in DocxExport::WriteProperties() 
(this=0x7ffecd609d78) at sw/source/filter/ww8/docxexport.cxx:952
    19 0x00007fa9bee24b0b in DocxExport::DocxExport(DocxExportFilter&, SwDoc&, 
std::shared_ptr<SwUnoCursor>&, SwPaM&, bool, bool)
        (this=0x7ffecd609d78, rFilter=..., rDocument=..., 
pCurrentPam=std::shared_ptr<SwUnoCursor> (use count 1, weak count 1) = {...}, 
rOriginalPam=SwPaM = {...}, bDocm=false, bTemplate=false)
        at sw/source/filter/ww8/docxexport.cxx:2149
    20 0x00007fa9bee4438e in DocxExportFilter::exportDocument() 
(this=0x559f318ed5f0) at sw/source/filter/ww8/docxexportfilter.cxx:112
    21 0x00007fa9bf9d6b8b in 
oox::core::FilterBase::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>
 const&) (this=0x559f318ed5f0, rMediaDescSeq=uno::Sequence of length 12 = {...})
        at oox/source/core/filterbase.cxx:494
    
    full bt here:
    https://bugs.documentfoundation.org/attachment.cgi?id=193113
    
    Patch prevents LO from crashing + make LO displays error message:
    Error saving the document <filename>:
    Write Error.
    The file could not be written
    
    Change-Id: I41a94eeb17bb6568b586d89755bce330154d1dad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164808
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 6a2a51e47577..1fafb6ac9e4f 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -491,7 +491,7 @@ sal_Bool SAL_CALL FilterBase::filter( const Sequence< 
PropertyValue >& rMediaDes
                 if( mxImpl->mxOutStream.is() )
                 {
                     mxImpl->mxStorage = implCreateStorage( mxImpl->mxOutStream 
);
-                    bRet = mxImpl->mxStorage && exportDocument() && 
implFinalizeExport( getMediaDescriptor() );
+                    bRet = mxImpl->mxStorage && mxImpl->mxStorage->isStorage() 
&& exportDocument() && implFinalizeExport( getMediaDescriptor() );
                 }
             break;
         }

Reply via email to