[PATCH] gdiplus: Check return value of SelectClipPath in brush_fill_path().

Zhiyi Zhang zzhang at codeweavers.com
Fri Jun 15 04:04:48 CDT 2018


For Crossover bug 16126.

When GraphicPath is empty, filling path with gdi32 will
result in a DC with empty path. When SelectClipPath() is
called with such a DC, it will fail because it requires
a closed path in DC. Thus further operation should be canceled.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/gdiplus/graphics.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 76aabe74bf..2a95d686fa 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -1052,6 +1052,7 @@ static BOOL brush_can_fill_path(GpBrush *brush, BOOL is_fill)
 
 static void brush_fill_path(GpGraphics *graphics, GpBrush* brush)
 {
+    BOOL success;
     switch (brush->bt)
     {
     case BrushTypeSolidColor:
@@ -1064,8 +1065,8 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush)
             RECT rc;
             /* partially transparent fill */
 
-            SelectClipPath(graphics->hdc, RGN_AND);
-            if (GetClipBox(graphics->hdc, &rc) != NULLREGION)
+            success = SelectClipPath(graphics->hdc, RGN_AND);
+            if (success && GetClipBox(graphics->hdc, &rc) != NULLREGION)
             {
                 HDC hdc = CreateCompatibleDC(NULL);
 
-- 
2.17.1




More information about the wine-devel mailing list