sw_engine/stroke: hotfix the memory access violation

ensure that the number of contour/close data is properly paired.

issue: https://github.com/thorvg/thorvg/issues/2129
This commit is contained in:
Hermet Park 2024-04-03 11:36:24 +09:00 committed by Hermet Park
parent 287e6d33d2
commit a4a585d8f0

View file

@ -33,6 +33,7 @@ static bool _outlineBegin(SwOutline& outline)
//Make a contour if lineTo/curveTo without calling close or moveTo beforehand. //Make a contour if lineTo/curveTo without calling close or moveTo beforehand.
if (outline.pts.empty()) return false; if (outline.pts.empty()) return false;
outline.cntrs.push(outline.pts.count - 1); outline.cntrs.push(outline.pts.count - 1);
outline.closed.push(false);
outline.pts.push(outline.pts[outline.cntrs.last()]); outline.pts.push(outline.pts[outline.cntrs.last()]);
outline.types.push(SW_CURVE_TYPE_POINT); outline.types.push(SW_CURVE_TYPE_POINT);
return false; return false;