diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-07-13 16:23:32 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-07-14 12:11:03 +0200 |
commit | 5508e6b1f77da2e2333c1f62e87927309d111c63 (patch) | |
tree | 6195ced455e0d420b0bb486c445ba6c7923bd86b /svgio | |
parent | 5d032804bce64ded3ddd3cec931dc9fca087a73b (diff) |
Resolves: tdf#108903 avoid recurse to death
Change-Id: Iadde719a024c5fce97aa0f4c58947a5012639a84
Reviewed-on: https://gerrit.libreoffice.org/39921
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 2f64f2871d4e4091061d791db647de57ed390109)
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/inc/svgusenode.hxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svgusenode.cxx | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/svgio/inc/svgusenode.hxx b/svgio/inc/svgusenode.hxx index a6eccaa05cd0..26c915b6ee2a 100644 --- a/svgio/inc/svgusenode.hxx +++ b/svgio/inc/svgusenode.hxx @@ -43,6 +43,8 @@ namespace svgio /// link to content. If maXLink is set, the node can be fetched // on demand OUString maXLink; + /// detect if maXLink causes a loop to ourself during decomposing + mutable bool mbDecomposingSvgNode; public: SvgUseNode( diff --git a/svgio/source/svgreader/svgusenode.cxx b/svgio/source/svgreader/svgusenode.cxx index 7495c2b1d5ad..7fdae9b3f68a 100644 --- a/svgio/source/svgreader/svgusenode.cxx +++ b/svgio/source/svgreader/svgusenode.cxx @@ -35,7 +35,8 @@ namespace svgio maY(), maWidth(), maHeight(), - maXLink() + maXLink(), + mbDecomposingSvgNode(false) { } @@ -143,7 +144,7 @@ namespace svgio // try to access link to content const SvgNode* pXLink = getDocument().findSvgNodeById(maXLink); - if(pXLink && Display_none != pXLink->getDisplay()) + if (pXLink && Display_none != pXLink->getDisplay() && !mbDecomposingSvgNode) { // decompose children drawinglayer::primitive2d::Primitive2DContainer aNewTarget; @@ -151,9 +152,11 @@ namespace svgio // todo: in case mpXLink is a SVGTokenSvg or SVGTokenSymbol the // SVG docs want the getWidth() and getHeight() from this node // to be valid for the subtree. + mbDecomposingSvgNode = true; const_cast< SvgNode* >(pXLink)->setAlternativeParent(this); pXLink->decomposeSvgNode(aNewTarget, true); const_cast< SvgNode* >(pXLink)->setAlternativeParent(); + mbDecomposingSvgNode = false; if(!aNewTarget.empty()) { |