evas_vg_load_svg: Fix negative attrs length

Summary:
After finding no attributes but spaces, attrsLength could be negative.
This will cause a segfault in parser functions.
So, change the position of attrs_length to prevent this.

Test Plan:
Example SVG
```
<?xml version="1.0" encoding="UTF-8"?>
<svg><g  ></g></svg>
```

Reviewers: Hermet, raster, kimcinoo

Reviewed By: Hermet

Subscribers: #reviewers, cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12314
This commit is contained in:
junsu choi 2022-01-12 11:19:24 +09:00 committed by Hermet Park
parent 7a674c6a29
commit 3411c604f2
1 changed files with 1 additions and 1 deletions

View File

@ -2276,12 +2276,12 @@ _evas_svg_loader_xml_open_parser(Evas_SVG_Loader *loader,
{
// find out the tag name starting from content till sz length
sz = attrs - content;
attrs_length = length - sz;
while ((sz > 0) && (isspace(content[sz - 1])))
sz--;
if ((unsigned int)sz >= sizeof(tag_name)) return;
strncpy(tag_name, content, sz);
tag_name[sz] = '\0';
attrs_length = length - sz;
}
if ((method = _find_group_factory(tag_name)))