svg_loader: fixing cyclic cloning of nodes

The reference node doesn't have to be placed inside the defs block,
so when refering to it, it is necessary to search the entire node tree.
In case of invalid svg file this can lead to circular references.
Added prevention against such a sutuation.
This commit is contained in:
Mira Grudzinska 2022-01-16 23:34:31 +01:00 committed by Hermet Park
parent 9212c0d158
commit 04d3bb0ec0

View file

@ -1933,7 +1933,7 @@ static void _copyAttr(SvgNode* to, const SvgNode* from)
static void _cloneNode(SvgNode* from, SvgNode* parent)
{
SvgNode* newNode;
if (!from || !parent) return;
if (!from || !parent || from == parent) return;
newNode = _createNode(parent, from->type);
if (!newNode) return;