[Libreoffice-commits] core.git: sw/source

Caolán McNamara caolanm at redhat.com
Wed Jan 17 17:26:56 UTC 2018


 sw/source/filter/html/htmltab.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit db55054afb9011f7dcafcc72b222e1456fa7f187
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 17 15:32:01 2018 +0000

    ofz#5444 asserts and Null-dereference READ
    
    Change-Id: I35f31e8553045ae61f39dd5679af638ddc3364d8
    Reviewed-on: https://gerrit.libreoffice.org/48059
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 889ac46c3419..f79e405e75b4 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -3956,8 +3956,14 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
         }
 
         // Remove LFs at the paragraph end
-        if( StripTrailingLF()==0 && !m_pPam->GetPoint()->nContent.GetIndex() )
-            StripTrailingPara();
+        if (StripTrailingLF() == 0 && !m_pPam->GetPoint()->nContent.GetIndex())
+        {
+            HTMLTableContext* pTableContext = m_xTable ? m_xTable->GetContext() : nullptr;
+            SwPosition* pSavedPos = pTableContext ? pTableContext->GetPos() : nullptr;
+            const bool bDeleteSafe = !pSavedPos || pSavedPos->nNode != m_pPam->GetPoint()->nNode;
+            if (bDeleteSafe)
+                StripTrailingPara();
+        }
 
         // If there was an adjustment set for the cell, we need to close it
         std::unique_ptr<HTMLAttrContext> xCntxt(PopContext());


More information about the Libreoffice-commits mailing list