From f20ef0dc158626b207edfabaa90f86cadb98beb9 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Tue, 22 Jun 2021 16:07:55 +0900 Subject: [PATCH] svg_loader SvgLoader: Copy the missing composite url When copying an attribute, url information of stype's composite is overwritten with memcpy. This causes double free by deleting the wrong string in freeNodeStyle. --- src/loaders/svg/tvgSvgLoader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/loaders/svg/tvgSvgLoader.cpp b/src/loaders/svg/tvgSvgLoader.cpp index 1fd62503..883d96b6 100644 --- a/src/loaders/svg/tvgSvgLoader.cpp +++ b/src/loaders/svg/tvgSvgLoader.cpp @@ -1587,6 +1587,9 @@ static void _copyAttr(SvgNode* to, const SvgNode* from) //Copy style attribute; memcpy(to->style, from->style, sizeof(SvgStyleProperty)); + //Copy style composite attribute (clip-path, mask, ...) + if (from->style->comp.url) to->style->comp.url = new string(from->style->comp.url->c_str()); + //Copy node attribute switch (from->type) { case SvgNodeType::Circle: {