diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-08-22 10:31:35 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2015-08-23 18:34:32 +0000 |
commit | 4efb0056f24698516aa5550ec926255da45a2381 (patch) | |
tree | 138f1aa00fa8aa71362bbdb4246983013445592f /sw/source | |
parent | 44c27bfb62ee9e820b659132ad9f8799b67064cc (diff) |
check that src index is in doc range
(cherry picked from commit 3230c8cf1cf2dc486f038d369e7f4f44ffd6b0a7)
check that dest index is in doc range
(cherry picked from commit cd6c9aef7468120dd5ea5c747f35c98baf214613)
Change-Id: Ic81e7a14701ff30aa46a9293dd6db351bd350ba5
3006cf03cf97399a6c418162178acdb1d41c3b23
Reviewed-on: https://gerrit.libreoffice.org/17928
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/basflt/fltshell.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index 53a9b662306c..549731a2a8aa 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -120,8 +120,11 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck, // The only position of 0x0D will not be able to make region in the old logic // because it is beyond the length of para...need special consideration here. - SwCntntNode *const pCntntNode( - SwNodeIndex(rMkPos.m_nNode, +1).GetNode().GetCntntNode()); + sal_uLong nMk = rMkPos.m_nNode.GetIndex() + 1; + const SwNodes& rMkNodes = rMkPos.m_nNode.GetNodes(); + if (nMk >= rMkNodes.Count()) + return false; + SwCntntNode *const pCntntNode(rMkNodes[nMk]->GetCntntNode()); if (rMkPos == rPtPos && ((0 != rPtPos.m_nCntnt) || (pCntntNode && (0 != pCntntNode->Len()))) && ( RES_TXTATR_FIELD != nWhich @@ -138,7 +141,11 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck, rRegion.SetMark(); if (rMkPos.m_nNode != rPtPos.m_nNode) { - rRegion.GetPoint()->nNode = rPtPos.m_nNode.GetIndex() + 1; + sal_uLong n = rPtPos.m_nNode.GetIndex() + 1; + SwNodes& rNodes = rRegion.GetPoint()->nNode.GetNodes(); + if (n >= rNodes.Count()) + return false; + rRegion.GetPoint()->nNode = n; pCNd = GetCntntNode(pDoc, rRegion.GetPoint()->nNode, false); } rRegion.GetPoint()->nContent.Assign(pCNd, rPtPos.m_nCntnt); |