=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Check box dimensions in volume_map.
Alexandre Julliard
julliard at winehq.org
Wed Sep 18 15:49:59 CDT 2013
Module: wine
Branch: master
Commit: 2680f3301585e2263e3800454f51c8f09314926f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2680f3301585e2263e3800454f51c8f09314926f
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Wed Sep 18 12:24:57 2013 +0200
wined3d: Check box dimensions in volume_map.
---
dlls/wined3d/volume.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index fcab45b..2fa04c5 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -566,6 +566,28 @@ static BOOL volume_check_block_align(const struct wined3d_volume *volume,
return TRUE;
}
+static BOOL wined3d_volume_check_box_dimensions(const struct wined3d_volume *volume,
+ const struct wined3d_box *box)
+{
+ if (!box)
+ return TRUE;
+
+ if (box->left >= box->right)
+ return FALSE;
+ if (box->top >= box->bottom)
+ return FALSE;
+ if (box->front >= box->back)
+ return FALSE;
+ if (box->right > volume->resource.width)
+ return FALSE;
+ if (box->bottom > volume->resource.height)
+ return FALSE;
+ if (box->back > volume->resource.depth)
+ return FALSE;
+
+ return TRUE;
+}
+
HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
{
@@ -589,6 +611,11 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
WARN("Volume is already mapped.\n");
return WINED3DERR_INVALIDCALL;
}
+ if (!wined3d_volume_check_box_dimensions(volume, box))
+ {
+ WARN("Map box is invalid.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
if ((format->flags & WINED3DFMT_FLAG_BLOCKS) && !volume_check_block_align(volume, box))
{
WARN("Map box is misaligned for %ux%u blocks.\n",
More information about the wine-cvs
mailing list