Ken Thomases : gdiplus: Avoid infinite recursion in flatten_bezier().

Alexandre Julliard julliard at winehq.org
Tue Apr 25 16:22:34 CDT 2017


Module: wine
Branch: master
Commit: a3f0a5913299d675426e039b5f1d794993144fbf
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a3f0a5913299d675426e039b5f1d794993144fbf

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Apr 24 13:16:08 2017 -0500

gdiplus: Avoid infinite recursion in flatten_bezier().

If either of the recursive calls would have the same x2, y2, x3, and y3
arguments as the current call, the path is as flat as the precision of floats
allows.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdiplus/graphicspath.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 5a3356a..4d70796 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -142,6 +142,10 @@ static BOOL flatten_bezier(path_list_node_t *start, REAL x2, REAL y2, REAL x3, R
     mp[2].X = (mp[1].X + mp[3].X) / 2.0;
     mp[2].Y = (mp[1].Y + mp[3].Y) / 2.0;
 
+    if ((x2 == mp[0].X && y2 == mp[0].Y && x3 == mp[1].X && y3 == mp[1].Y) ||
+        (x2 == mp[3].X && y2 == mp[3].Y && x3 == mp[4].X && y3 == mp[4].Y))
+        return TRUE;
+
     pt = end->pt;
     pt_st = start->pt;
     /* check flatness as a half of distance between middle point and a linearized path */




More information about the wine-cvs mailing list