=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Block validation checks the surface size too.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jan 18 11:09:03 CST 2016


Module: wine
Branch: master
Commit: 48575df7cbd0431d878909b86cea38ccab4fee8b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=48575df7cbd0431d878909b86cea38ccab4fee8b

Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date:   Sun Jan 17 14:40:05 2016 +0000

wined3d: Block validation checks the surface size too.

Signed-off-by: Stefan Dösinger <stefandoesinger at gmx.at>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 16723df..0c7afd8 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 829a515..db33791 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;




More information about the wine-cvs mailing list