From: Patrick Rudolph Subject: [2/2] ddraw: return DDERR_INVALIDPARAMS on too large surface dimensions Message-Id: Date: Thu, 30 Oct 2014 19:42:18 +0100 changed subject to match patch content Please review. From 01bcf88144639254fd7ec350969a8c180eb1176d Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 30 Oct 2014 16:36:50 +0100 Subject: [PATCH] ddraw: return DDERR_INVALIDPARAMS on too large surface dimensions --- dlls/ddraw/surface.c | 2 +- dlls/ddraw/tests/ddraw1.c | 4 ++-- dlls/ddraw/tests/ddraw2.c | 4 ++-- dlls/ddraw/tests/ddraw4.c | 4 ++-- dlls/ddraw/tests/ddraw7.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 556d32f..f2708b3 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -5752,7 +5752,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ desc->dwHeight = mode.height; } - if (!desc->dwWidth || !desc->dwHeight) + if (!desc->dwWidth || !desc->dwHeight || (desc->dwWidth > 0xffff) || (desc->dwHeight > 0xffff)) { HeapFree(GetProcessHeap(), 0, texture); return DDERR_INVALIDPARAMS; diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 8dbbf91..4e4ecae 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -5734,9 +5734,9 @@ static void test_surface_size(void) hr = IDirectDraw_CreateSurface(ddraw, &surfacedesc, &surface, NULL); /* old graphic cards have a pitch limit of 128kb */ - if(tests[i].width >= 0xffff) + if(tests[i].width == 0xffff) todo_wine ok(hr == tests[i].hr || broken(hr == DDERR_INVALIDPARAMS), "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); - else if(tests[i].height >= 0xffff) + else if(tests[i].height == 0xffff) todo_wine ok(hr == tests[i].hr, "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); else ok(hr == tests[i].hr, "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 04dd4b7..a091287 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -6810,9 +6810,9 @@ static void test_surface_size(void) hr = IDirectDraw2_CreateSurface(ddraw, &surfacedesc, &surface, NULL); /* old graphic cards have a pitch limit of 128kb */ - if(tests[i].width >= 0xffff) + if(tests[i].width == 0xffff) todo_wine ok(hr == tests[i].hr || broken(hr == DDERR_INVALIDPARAMS), "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); - else if(tests[i].height >= 0xffff) + else if(tests[i].height == 0xffff) todo_wine ok(hr == tests[i].hr, "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); else ok(hr == tests[i].hr, "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index b6b687c..0fb5408 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -7885,9 +7885,9 @@ static void test_surface_size(void) hr = IDirectDraw4_CreateSurface(ddraw, &surfacedesc, &surface, NULL); /* old graphic cards have a pitch limit of 128kb */ - if(tests[i].width >= 0xffff) + if(tests[i].width == 0xffff) todo_wine ok(hr == tests[i].hr || broken(hr == DDERR_INVALIDPARAMS), "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); - else if(tests[i].height >= 0xffff) + else if(tests[i].height == 0xffff) todo_wine ok(hr == tests[i].hr, "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); else ok(hr == tests[i].hr, "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 7274ccd..16aabd4 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -7728,9 +7728,9 @@ static void test_surface_size(void) hr = IDirectDraw7_CreateSurface(ddraw, &surfacedesc, &surface, NULL); /* old graphic cards have a pitch limit of 128kb */ - if(tests[i].width >= 0xffff) + if(tests[i].width == 0xffff) todo_wine ok(hr == tests[i].hr || broken(hr == DDERR_INVALIDPARAMS), "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); - else if(tests[i].height >= 0xffff) + else if(tests[i].height == 0xffff) todo_wine ok(hr == tests[i].hr, "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); else ok(hr == tests[i].hr, "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); -- 1.9.3