vg_common_svg: Fix when the number of polygon points is odd

Summary: If the number of points is odd, an overflow occurs in array[i+1].

Test Plan:
Test Svg image
```
<svg xmlns="http://www.w3.org/2000/svg" id="svg1" viewBox="0 0 200 200">
    <title>Not enough points</title>
    <desc>Must contain at least 4 points</desc>

    <polygon id="polygon1" points="20 40 160 40 10" fill="none" stroke="red"/>

    <!-- image frame -->
    <rect id="frame" x="1" y="1" width="198" height="198" fill="none" stroke="black"/>
</svg>
```

Reviewers: Hermet, raster, kimcinoo

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12319
This commit is contained in:
junsu choi 2022-01-12 11:35:31 +09:00 committed by Hermet Park
parent ef784708b9
commit 7b4c9284a9
1 changed files with 1 additions and 1 deletions

View File

@ -832,7 +832,7 @@ _add_polyline(Efl_VG *vg, double *array, int size, Eina_Bool polygon)
if (size < 2) return; if (size < 2) return;
efl_gfx_path_append_move_to(vg, array[0], array[1]); efl_gfx_path_append_move_to(vg, array[0], array[1]);
for (i=2; i < size; i+=2) for (i = 2; i < size - 1; i += 2)
efl_gfx_path_append_line_to(vg, array[i], array[i+1]); efl_gfx_path_append_line_to(vg, array[i], array[i+1]);
if (polygon) if (polygon)