From b06ef4699e486368840bf0f7457debbe7f985ab0 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 9 Dec 2017 19:37:36 +0000 Subject: ofz: crash on null pTableNd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9396afb40d75ee2463005a4501233dde1683f556 Reviewed-on: https://gerrit.libreoffice.org/46165 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/filter/html/htmltab.cxx | 2 ++ sw/source/filter/html/swhtml.cxx | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index b8518a497f17..8f7dccdeb8ee 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -2715,6 +2715,8 @@ const SwStartNode *SwHTMLParser::InsertTableSection( sal_uInt16 nPoolId ) else { SwTableNode *pTableNd = pNd->FindTableNode(); + if (!pTableNd) + throw std::runtime_error("missing table"); if( pTableNd->GetTable().GetHTMLTableLayout() ) { // if there is already a HTMTableLayout, this table is already finished // and we have to look for the right table in the environment diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index bd4b8edb7878..1ddf9f741270 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -5533,7 +5533,14 @@ bool TestImportHTML(SvStream &rStream) SwPaM aPaM( aIdx ); aPaM.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(), 0); pD->SetInReading(true); - bool bRet = xReader->Read(*pD, OUString(), aPaM, OUString()) == ERRCODE_NONE; + bool bRet = false; + try + { + bRet = xReader->Read(*pD, OUString(), aPaM, OUString()) == ERRCODE_NONE; + } + catch (const std::runtime_error&) + { + } pD->SetInReading(false); return bRet; -- cgit