Commit 48575df7 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Block validation checks the surface size too.

parent 638f6c1a
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment