[PATCH v3 0/1] MR10929: gdi32: Validate count parameter in ExtCreateRegion
-- v3: gdi32: Validate count parameter in ExtCreateRegion https://gitlab.winehq.org/wine/wine/-/merge_requests/10929
From: Bartosz Kosiorek <gang65@poczta.onet.pl> --- dlls/gdi32/objects.c | 2 +- dlls/gdi32/tests/clipping.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index f2b353cff27..12eaddcd623 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -642,7 +642,7 @@ HBITMAP WINAPI CreateDiscardableBitmap( HDC hdc, INT width, INT height ) */ HRGN WINAPI ExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA *data ) { - if (!data) + if (!data || count < sizeof(RGNDATAHEADER)) { SetLastError( ERROR_INVALID_PARAMETER ); return 0; diff --git a/dlls/gdi32/tests/clipping.c b/dlls/gdi32/tests/clipping.c index ce66f9cad09..b6da5889dea 100644 --- a/dlls/gdi32/tests/clipping.c +++ b/dlls/gdi32/tests/clipping.c @@ -225,9 +225,7 @@ static void test_ExtCreateRegion(void) /* Cannot be smaller than sizeof(RGNDATAHEADER) */ SetLastError(0xdeadbeef); hrgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) - 1, &rgn.data); - todo_wine ok(!hrgn, "ExtCreateRegion should fail\n"); - todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), "0xdeadbeef, got %lu\n", GetLastError()); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10929
participants (2)
-
Bartosz Kosiorek -
Bartosz Kosiorek (@gang65)