[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - svgio/inc svgio/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Jul 18 20:31:34 UTC 2018
svgio/inc/svggradientnode.hxx | 1
svgio/source/svgreader/svggradientnode.cxx | 75 ++++++++++++++++++++---------
2 files changed, 55 insertions(+), 21 deletions(-)
New commits:
commit b59d639a5fbbddd976d6c79ea12460b553426887
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 18 12:12:05 2018 +0100
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Jul 18 22:31:11 2018 +0200
crashtesting: infinite recurse on moz330387-6.svg
Change-Id: I3c39d49504a4651b92f41c07e4cef8887366dc2b
Reviewed-on: https://gerrit.libreoffice.org/57627
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/svgio/inc/svggradientnode.hxx b/svgio/inc/svggradientnode.hxx
index 3710519dc392..1542796b48fc 100644
--- a/svgio/inc/svggradientnode.hxx
+++ b/svgio/inc/svggradientnode.hxx
@@ -56,6 +56,7 @@ namespace svgio
/// link to another gradient used as style. If maXLink
/// is set, the node can be fetched on demand by using
// tryToFindLink (buffered)
+ mutable bool mbResolvingLink; // protect against infinite link recursion
OUString maXLink;
const SvgGradientNode* mpXLink;
diff --git a/svgio/source/svgreader/svggradientnode.cxx b/svgio/source/svgreader/svggradientnode.cxx
index 4496a809a8cf..efbfdccaadb5 100644
--- a/svgio/source/svgreader/svggradientnode.cxx
+++ b/svgio/source/svgreader/svggradientnode.cxx
@@ -51,6 +51,7 @@ namespace svgio
maGradientUnits(objectBoundingBox),
maSpreadMethod(drawinglayer::primitive2d::SpreadMethod::Pad),
mpaGradientTransform(nullptr),
+ mbResolvingLink(false),
maXLink(),
mpXLink(nullptr)
{
@@ -246,9 +247,11 @@ namespace svgio
{
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
+ mbResolvingLink = true;
mpXLink->collectGradientEntries(aVector);
+ mbResolvingLink = false;
}
}
else
@@ -312,9 +315,12 @@ namespace svgio
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
- return mpXLink->getX1();
+ mbResolvingLink = true;
+ auto ret = mpXLink->getX1();
+ mbResolvingLink = false;
+ return ret;
}
// default is 0%
@@ -330,9 +336,12 @@ namespace svgio
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
- return mpXLink->getY1();
+ mbResolvingLink = true;
+ auto ret = mpXLink->getY1();
+ mbResolvingLink = false;
+ return ret;
}
// default is 0%
@@ -348,9 +357,12 @@ namespace svgio
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
- return mpXLink->getX2();
+ mbResolvingLink = true;
+ auto ret = mpXLink->getX2();
+ mbResolvingLink = false;
+ return ret;
}
// default is 100%
@@ -366,9 +378,12 @@ namespace svgio
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
- return mpXLink->getY2();
+ mbResolvingLink = true;
+ auto ret = mpXLink->getY2();
+ mbResolvingLink = false;
+ return ret;
}
// default is 0%
@@ -384,9 +399,12 @@ namespace svgio
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
- return mpXLink->getCx();
+ mbResolvingLink = true;
+ auto ret = mpXLink->getCx();
+ mbResolvingLink = false;
+ return ret;
}
// default is 50%
@@ -402,9 +420,12 @@ namespace svgio
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
- return mpXLink->getCy();
+ mbResolvingLink = true;
+ auto ret = mpXLink->getCy();
+ mbResolvingLink = false;
+ return ret;
}
// default is 50%
@@ -420,9 +441,12 @@ namespace svgio
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
- return mpXLink->getR();
+ mbResolvingLink = true;
+ auto ret = mpXLink->getR();
+ mbResolvingLink = false;
+ return ret;
}
// default is 50%
@@ -438,9 +462,12 @@ namespace svgio
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
- return mpXLink->getFx();
+ mbResolvingLink = true;
+ auto ret = mpXLink->getFx();
+ mbResolvingLink = false;
+ return ret;
}
return nullptr;
@@ -455,9 +482,12 @@ namespace svgio
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
- return mpXLink->getFy();
+ mbResolvingLink = true;
+ auto ret = mpXLink->getFy();
+ mbResolvingLink = false;
+ return ret;
}
return nullptr;
@@ -472,9 +502,12 @@ namespace svgio
const_cast< SvgGradientNode* >(this)->tryToFindLink();
- if(mpXLink)
+ if (mpXLink && !mbResolvingLink)
{
- return mpXLink->getGradientTransform();
+ mbResolvingLink = true;
+ auto ret = mpXLink->getGradientTransform();
+ mbResolvingLink = false;
+ return ret;
}
return nullptr;
More information about the Libreoffice-commits
mailing list