[Libreoffice-commits] core.git: sw/source
Michael Stahl
mstahl at redhat.com
Wed Feb 22 21:45:48 UTC 2017
sw/source/filter/basflt/fltshell.cxx | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
New commits:
commit d47c009ec5bc15afbd7792ce236a02a712edb2ac
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Feb 22 22:37:12 2017 +0100
sw: WW8 import: avoid assert on ooo99613-3.doc and ooo99613-4.doc
sw/source/core/txtnode/thints.cxx:1244: bool SwTextNode::InsertHint(SwTextAttr*, SetAttrMode): Assertion `!pAttr->GetEnd() || (*pAttr->GetEnd() <= Len())' failed.
These files were created by a buggy OOo and Word 2010 considers them
corrupt and pops up scary warning dialogs, so just avoid inserting hints
with invalid positions, there's not really anything fixable here.
Change-Id: I65b5b963d7b4e28fd9551ccadd71b581f118106c
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index 7d8745ec..73b26e3 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -148,7 +148,11 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck,
// The content indices always apply to the node!
rRegion.GetPoint()->nNode = rMkPos.m_nNode.GetIndex() + 1;
SwContentNode* pCNd = GetContentNode(pDoc, rRegion.GetPoint()->nNode, true);
- rRegion.GetPoint()->nContent.Assign(pCNd, rMkPos.m_nContent);
+
+ SAL_WARN_IF(pCNd->Len() < rMkPos.m_nContent, "sw.ww8",
+ "invalid content index " << rMkPos.m_nContent << " but text node has only " << pCNd->Len());
+ rRegion.GetPoint()->nContent.Assign(pCNd,
+ std::min<sal_Int32>(rMkPos.m_nContent, pCNd->Len()));
rRegion.SetMark();
if (rMkPos.m_nNode != rPtPos.m_nNode)
{
@@ -159,7 +163,10 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck,
rRegion.GetPoint()->nNode = n;
pCNd = GetContentNode(pDoc, rRegion.GetPoint()->nNode, false);
}
- rRegion.GetPoint()->nContent.Assign(pCNd, rPtPos.m_nContent);
+ SAL_WARN_IF(pCNd->Len() < rPtPos.m_nContent, "sw.ww8",
+ "invalid content index " << rPtPos.m_nContent << " but text node has only " << pCNd->Len());
+ rRegion.GetPoint()->nContent.Assign(pCNd,
+ std::min<sal_Int32>(rPtPos.m_nContent, pCNd->Len()));
OSL_ENSURE( CheckNodesRange( rRegion.Start()->nNode,
rRegion.End()->nNode, true ),
"attribute or similar crosses section-boundaries" );
More information about the Libreoffice-commits
mailing list