From: David Kahurani <k.kahurani(a)gmail.com> Empty the path, albeit temporarily before trying to lengthen the path because the data contained in it is at this point, unless an error happens, invalid. This avoids a situation where lengthening code, assuming the data in the path is valid proceeds to lengthen the path further. Signed-off-by: David Kahurani <k.kahurani(a)gmail.com> --- dlls/gdiplus/graphicspath.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 7b85355773a..ea9f1ed9aed 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -1333,7 +1333,7 @@ GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatnes { path_list_node_t *list, *node; GpPointF pt; - INT i = 1; + INT i = 1, old_count; INT startidx = 0; GpStatus stat; @@ -1345,6 +1345,7 @@ GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatnes if(path->pathdata.Count == 0) return Ok; + old_count = path->pathdata.Count; stat = GdipTransformPath(path, matrix); if(stat != Ok) return stat; @@ -1407,6 +1408,7 @@ GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatnes /* store path data back */ i = path_list_count(list); + path->pathdata.Count = 0; if(!lengthen_path(path, i)) goto memout; path->pathdata.Count = i; @@ -1422,6 +1424,7 @@ GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatnes return Ok; memout: + path->pathdata.Count = old_count; free_path_list(list); return OutOfMemory; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4803