wined3d: Block validation checks the surface size too.

Signed-off-by: Stefan Dösinger <stefandoesinger@gmx.at>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2016-01-17 14:40:05 +00:00 committed by Alexandre Julliard
parent 638f6c1ac8
commit 48575df7cb
2 changed files with 7 additions and 1 deletions

View File

@ -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);

View File

@ -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;