=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d9: Return D3DERR_INVALIDCALL when IDirect3DCubeTexture9:: GetLevelDesc is called with invalid level.

Alexandre Julliard julliard at winehq.org
Tue May 22 14:21:28 CDT 2012


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

Author: Józef Kucia <joseph.kucia at gmail.com>
Date:   Mon May 21 23:10:45 2012 +0200

d3d9: Return D3DERR_INVALIDCALL when IDirect3DCubeTexture9::GetLevelDesc is called with invalid level.

---

 dlls/d3d9/texture.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c
index f453f90..0594c20 100644
--- a/dlls/d3d9/texture.c
+++ b/dlls/d3d9/texture.c
@@ -710,10 +710,18 @@ static HRESULT WINAPI d3d9_texture_cube_GetLevelDesc(IDirect3DCubeTexture9 *ifac
     struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
     struct wined3d_resource *sub_resource;
     HRESULT hr = D3D_OK;
+    DWORD level_count;
 
     TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
 
     wined3d_mutex_lock();
+    level_count = wined3d_texture_get_level_count(texture->wined3d_texture);
+    if (level >= level_count)
+    {
+        wined3d_mutex_unlock();
+        return D3DERR_INVALIDCALL;
+    }
+
     if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
         hr = D3DERR_INVALIDCALL;
     else




More information about the wine-cvs mailing list