[PATCH v2] d2d1: Fix the stack overflow error caused by d2d_cdt_triangulate().

Changsheng Chen chenchangsheng at uniontech.com
Mon Sep 13 21:12:19 CDT 2021


Fix stack overflow in d2d_cdt_triangulate if vertext_count less than 2.

Signed-off-by: Changsheng Chen <chenchangsheng at uniontech.com>
---
 dlls/d2d1/geometry.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index 6da93de3eb4..71b989fe7c1 100644
--- a/dlls/d2d1/geometry.c
+++ b/dlls/d2d1/geometry.c
@@ -2066,7 +2066,7 @@ static HRESULT d2d_path_geometry_triangulate(struct d2d_geometry *geometry)
 
     cdt.free_edge = ~0u;
     cdt.vertices = vertices;
-    if (!d2d_cdt_triangulate(&cdt, 0, vertex_count, &left_edge, &right_edge))
+    if (vertex_count > 1 && !d2d_cdt_triangulate(&cdt, 0, vertex_count, &left_edge, &right_edge))
         goto fail;
     if (!d2d_cdt_insert_segments(&cdt, geometry))
         goto fail;
-- 
2.20.1






More information about the wine-devel mailing list