mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 20:14:37 +00:00
svg_loader: initializing uninitialized variables
The 'loader->svgParse->global' variable was uninitialized when no viewBox attribute was set. If gradient was applied, the division by zero occured and no gradient was drawn.
This commit is contained in:
parent
73ea4abf51
commit
ae5673658e
1 changed files with 6 additions and 0 deletions
|
@ -1069,9 +1069,15 @@ static SvgNode* _createSvgNode(SvgLoaderData* loader, SvgNode* parent, const cha
|
|||
if (!loader->svgParse->node) return nullptr;
|
||||
SvgDocNode* doc = &(loader->svgParse->node->node.doc);
|
||||
|
||||
loader->svgParse->global.w = 0;
|
||||
loader->svgParse->global.h = 0;
|
||||
|
||||
doc->preserveAspect = true;
|
||||
simpleXmlParseAttributes(buf, bufLength, _attrParseSvgNode, loader);
|
||||
|
||||
if (loader->svgParse->global.w == 0) loader->svgParse->global.w = loader->svgParse->node->node.doc.w;
|
||||
if (loader->svgParse->global.h == 0) loader->svgParse->global.h = loader->svgParse->node->node.doc.h;
|
||||
|
||||
return loader->svgParse->node;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue