diff options
author | JunsuChoi <jsuya.choi@samsung.com> | 2022-01-12 11:19:24 +0900 |
---|---|---|
committer | Hermet Park <chuneon.park@samsung.com> | 2022-01-12 11:19:24 +0900 |
commit | 3411c604f2a7d226e288d36becb6fb5e286516db (patch) | |
tree | 5a4e3ce974bab6c390f89a51f64800afd6f7f029 | |
parent | 7a674c6a29a408c6103bcc00c3bddee295fea07e (diff) | |
download | efl-3411c604f2a7d226e288d36becb6fb5e286516db.tar.gz |
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
-rw-r--r-- | src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c index 465b499505..8531aedbd3 100644 --- a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c +++ b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c @@ -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))) |