=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d8: Return D3DERR_INVALIDCALL when IDirect3DCubeTexture8:: GetCubeMapSurface is called with invalid level.

Alexandre Julliard julliard at winehq.org
Wed May 23 13:22:54 CDT 2012


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

Author: Józef Kucia <joseph.kucia at gmail.com>
Date:   Tue May 22 22:19:32 2012 +0200

d3d8: Return D3DERR_INVALIDCALL when IDirect3DCubeTexture8::GetCubeMapSurface is called with invalid level.

---

 dlls/d3d8/texture.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c
index 6b5f95c..14f8207 100644
--- a/dlls/d3d8/texture.c
+++ b/dlls/d3d8/texture.c
@@ -656,11 +656,19 @@ static HRESULT WINAPI d3d8_texture_cube_GetCubeMapSurface(IDirect3DCubeTexture8
     struct wined3d_resource *sub_resource;
     struct d3d8_surface *surface_impl;
     UINT sub_resource_idx;
+    DWORD level_count;
 
     TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, face, level, surface);
 
     wined3d_mutex_lock();
-    sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level;
+    level_count = wined3d_texture_get_level_count(texture->wined3d_texture);
+    if (level >= level_count)
+    {
+        wined3d_mutex_unlock();
+        return D3DERR_INVALIDCALL;
+    }
+
+    sub_resource_idx = level_count * face + level;
     if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
     {
         wined3d_mutex_unlock();




More information about the wine-cvs mailing list