Gabriel Ivăncescu : gdi32: Skip scan conversion on overflow.
Alexandre Julliard
julliard at winehq.org
Tue Jun 9 15:27:47 CDT 2020
Module: wine
Branch: master
Commit: 7bb5b074b5b6a13e13a21accc35947fc927ca33e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=7bb5b074b5b6a13e13a21accc35947fc927ca33e
Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date: Tue Jun 9 10:54:49 2020 +0100
gdi32: Skip scan conversion on overflow.
Fixes a regression introduced by 9bc6f004ceccf3963584a4f7f4681b5c0578c214,
which broke when REGION_CreateEdgeTable overflowed.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/region.c | 2 +-
dlls/gdi32/tests/clipping.c | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/region.c b/dlls/gdi32/region.c
index 893b6d6f4d..878b73f8c9 100644
--- a/dlls/gdi32/region.c
+++ b/dlls/gdi32/region.c
@@ -2742,7 +2742,7 @@ HRGN create_polypolygon_region( const POINT *Pts, const INT *Count, INT nbpolygo
nb_points = REGION_CreateEdgeTable( Count, nbpolygons, Pts, &ET, pETEs, &SLLBlock, clip_rect );
if ((obj = alloc_region( nb_points / 2 )))
{
- scan_convert( obj, &ET, mode, clip_rect );
+ if (nb_points) scan_convert( obj, &ET, mode, clip_rect );
if (!(hrgn = alloc_gdi_handle( obj, OBJ_REGION, ®ion_funcs )))
free_region( obj );
diff --git a/dlls/gdi32/tests/clipping.c b/dlls/gdi32/tests/clipping.c
index 015157522d..484430b0cb 100644
--- a/dlls/gdi32/tests/clipping.c
+++ b/dlls/gdi32/tests/clipping.c
@@ -513,8 +513,10 @@ static void test_CreatePolyPolygonRgn(void)
POINT points_mixed[] = { {0, 0}, {0, 0}, {0, 0}, {6, 6}, {6, 6}, {6, 6} };
POINT points_six[] = { {6, 6}, {6, 6}, {6, 6} };
POINT points_line[] = { {1, 0}, {11, 0}, {21, 0}};
+ POINT points_overflow[] = { {0, 0}, {1, 0}, {0, 0x80000000} };
INT counts_single_poly[] = { 3 };
INT counts_two_poly[] = { 3, 3 };
+ INT counts_overflow[] = { ARRAY_SIZE(points_overflow) };
int ret;
RECT rect;
@@ -543,6 +545,13 @@ static void test_CreatePolyPolygonRgn(void)
ret = GetRgnBox(region, &rect);
ok (ret == NULLREGION, "Expected NULLREGION, got %d\n", ret);
DeleteObject(region);
+
+ /* Test with points that overflow the edge table */
+ region = CreatePolyPolygonRgn(points_overflow, counts_overflow, ARRAY_SIZE(counts_overflow), ALTERNATE);
+ ok (region != NULL, "region must not be NULL\n");
+ ret = GetRgnBox(region, &rect);
+ ok (ret == NULLREGION, "Expected NULLREGION, got %d\n", ret);
+ DeleteObject(region);
}
START_TEST(clipping)
More information about the wine-cvs
mailing list