From 56a65007214b244710418f62ed8a1d5d1e257d5f Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 13 Nov 2013 14:00:30 +0900 Subject: [PATCH] gdiplus: Check whether region path points really fit into shorts. --- dlls/gdiplus/region.c | 6 ++++-- dlls/gdiplus/tests/region.c | 14 -------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c index 0295e627b4a..5d95fcdaf91 100644 --- a/dlls/gdiplus/region.c +++ b/dlls/gdiplus/region.c @@ -96,8 +96,10 @@ static BOOL is_integer_path(const GpPath *path) for (i = 0; i < path->pathdata.Count; i++) { - if (path->pathdata.Points[i].X != gdip_round(path->pathdata.Points[i].X) || - path->pathdata.Points[i].Y != gdip_round(path->pathdata.Points[i].Y)) + short x, y; + x = gdip_round(path->pathdata.Points[i].X); + y = gdip_round(path->pathdata.Points[i].Y); + if (path->pathdata.Points[i].X != (REAL)x || path->pathdata.Points[i].Y != (REAL)y) return FALSE; } return TRUE; diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c index 77fb4feb09c..2b4f148f116 100644 --- a/dlls/gdiplus/tests/region.c +++ b/dlls/gdiplus/tests/region.c @@ -617,44 +617,30 @@ static void test_getregiondata(void) needed = 0; status = GdipGetRegionDataSize(region, &needed); ok(status == Ok, "status %08x\n", status); -todo_wine expect(72, needed); memset(buf, 0xee, sizeof(buf)); needed = 0; status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed); ok(status == Ok, "status %08x\n", status); -todo_wine expect(72, needed); -todo_wine expect_dword(buf, 64); trace("buf[1] = %08x\n", buf[1]); expect_magic(buf + 2); expect_dword(buf + 3, 0); expect_dword(buf + 4, RGNDATA_PATH); -todo_wine expect_dword(buf + 5, 48); expect_magic(buf + 6); expect_dword(buf + 7, 4); /* flags 0 means that a path is an array of FLOATs */ -todo_wine expect_dword(buf + 8, 0); -todo_wine expect_float(buf + 9, -196900.0); -todo_wine expect_float(buf + 10, -197400.0); -todo_wine expect_float(buf + 11, 2600.0); -todo_wine expect_float(buf + 12, -197400.0); -todo_wine expect_float(buf + 13, 2600.0); -todo_wine expect_float(buf + 14, 2300.0); -todo_wine expect_float(buf + 15, -196900.0); -todo_wine expect_float(buf + 16, 2300.0); -todo_wine expect_dword(buf + 17, 0x81010100); /* 0x01010100 if we don't close the path */ status = GdipDeletePath(path); -- 2.11.4.GIT