sw/source/writerfilter/dmapper/DomainMapper.cxx  |   13 ++++++++-----
 sw/source/writerfilter/dmapper/SettingsTable.cxx |    1 +
 2 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit d10c9d1d26cb1d7911deeafea44ce076535059d7
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon Jun 23 13:12:41 2025 -0400
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Wed Jun 25 01:52:03 2025 +0200

    tdf#166092 writerfilter: exception killed critical settings
    
    I also took the opportunity to move one setting
    (that was placed directly into the DTOR)
    into where these things are normally stored in ApplyProperties
    (which is called just a bit earlier in that same DTOR).
    
    I tried setting an assert when this fails,
    but already hit
    sw/qa/writerfilter/filters-test/data/pass/CVE-2005-2964-1.rtf
    
    An earlier patchset contains the unit test.
    However, I did not include it because it takes a VERY long time
    to load in a debug environment,
    and it seems pointless to try to create a minimal document
    that still causes a very strange footnote exception.
    
    Change-Id: Ia2b38232e21149407bccceea4ac859d1f38426e6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186856
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    (cherry picked from commit 0df64acd9190e36ad53f8fa111b0becf0893630b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186892

diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 51239d40bed8..b511e485d0b4 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -225,7 +225,11 @@ DomainMapper::~DomainMapper()
     {
         // Remove temporary footnotes and endnotes
         m_pImpl->RemoveTemporaryFootOrEndnotes();
+    }
+    catch( const uno::Exception& ) {}
 
+    try
+    {
         sal_Int32 nIndexes = 0;
         if ( m_pImpl->GetTextDocument() )
             nIndexes = 
m_pImpl->GetTextDocument()->getDocumentIndexes()->getCount();
@@ -275,12 +279,11 @@ DomainMapper::~DomainMapper()
             aGrabBag.update(aProperties);
             
m_pImpl->GetTextDocument()->setPropertyValue(u"InteropGrabBag"_ustr, 
uno::Any(aGrabBag.getAsConstPropertyValueList()));
         }
-        // tdf#138782: for docs created in MS Word 2010 and older 
(compatibilityMode <= 14)
-        m_pImpl->SetDocumentSettingsProperty(
-            u"AddFrameOffsets"_ustr,
-            uno::Any(14 >= 
m_pImpl->GetSettingsTable()->GetWordCompatibilityMode()));
     }
-    catch( const uno::Exception& ) {}
+    catch(const uno::Exception&)
+    {
+        DBG_UNHANDLED_EXCEPTION("writerfilter", "failed to set critical 
document settings");
+    }
 
 #ifdef DBG_UTIL
     TagLogger::getInstance().endDocument();
diff --git a/sw/source/writerfilter/dmapper/SettingsTable.cxx 
b/sw/source/writerfilter/dmapper/SettingsTable.cxx
index fcd24b6d53f8..c1a94169d8de 100644
--- a/sw/source/writerfilter/dmapper/SettingsTable.cxx
+++ b/sw/source/writerfilter/dmapper/SettingsTable.cxx
@@ -687,6 +687,7 @@ void 
SettingsTable::ApplyProperties(rtl::Reference<SwXTextDocument> const& xDoc)
     {
         
xDocumentSettings->setPropertyValue(u"MsWordCompMinLineHeightByFly"_ustr, 
uno::Any(true));
         xDocumentSettings->setPropertyValue(u"TabOverMargin"_ustr, 
uno::Any(true));
+        xDocumentSettings->setPropertyValue(u"AddFrameOffsets"_ustr, 
uno::Any(true)); // tdf#138782
     }
 
     // Show changes value

Reply via email to