From 137e42521944c0f3d7ff73891917a476f2868996 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 16 Sep 2016 22:32:29 +0200 Subject: tdf#102233: avoid infinite loop recursion in IsProtect node method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://bugs.documentfoundation.org/show_bug.cgi?id=102233#c5 Change-Id: Ic985662011b33d4b20b7c60df33c9ecc97326e85 Reviewed-on: https://gerrit.libreoffice.org/28972 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara (cherry picked from commit cd72269a6a2c85ae9dd4552aa4808ef4fd1f6c0e) Reviewed-on: https://gerrit.libreoffice.org/29152 Tested-by: Jenkins --- sw/source/core/docnode/node.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sw') diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 392143c44e96..4273fd0aa538 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -433,10 +433,14 @@ bool SwNode::IsProtect() const SwFrameFormat* pFlyFormat = GetFlyFormat(); if( pFlyFormat ) { - if( pFlyFormat->GetProtect().IsContentProtected() ) + if (pFlyFormat->GetProtect().IsContentProtected()) return true; const SwFormatAnchor& rAnchor = pFlyFormat->GetAnchor(); - return rAnchor.GetContentAnchor() && rAnchor.GetContentAnchor()->nNode.GetNode().IsProtect(); + const SwPosition* pAnchorPos = rAnchor.GetContentAnchor(); + if (!pAnchorPos) + return false; + const SwNode& rAnchorNd = pAnchorPos->nNode.GetNode(); + return &rAnchorNd != this && rAnchorNd.IsProtect(); } if( nullptr != ( pSttNd = FindFootnoteStartNode() ) ) -- cgit