From 48575df7cbd0431d878909b86cea38ccab4fee8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 17 Jan 2016 14:40:05 +0000 Subject: [PATCH] wined3d: Block validation checks the surface size too. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Dösinger Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d9/tests/device.c | 2 +- dlls/wined3d/surface.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 16723dfd643..0c7afd8c79b 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -7944,7 +7944,7 @@ static void test_surface_blocks(void) rect.right = formats[i].block_width; rect.bottom = formats[i].block_height; hr = IDirect3DTexture9_LockRect(texture, 1, &locked_rect, &rect, 0); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); if (SUCCEEDED(hr)) IDirect3DTexture9_UnlockRect(texture, 1); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 829a515964a..db33791c40e 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1538,6 +1538,12 @@ static BOOL surface_check_block_align(struct wined3d_surface *surface, const str && box->bottom == surface->resource.height) return TRUE; + if ((box->left >= box->right) + || (box->top >= box->bottom) + || (box->right > surface->resource.width) + || (box->bottom > surface->resource.height)) + return FALSE; + /* This assumes power of two block sizes, but NPOT block sizes would be * silly anyway. */ width_mask = surface->resource.format->block_width - 1;