Christian Costa : d3dx9_36: Avoid dereferencing null pointers in trace ( spotted by Paul Vriens).

Alexandre Julliard julliard at winehq.org
Thu Mar 4 11:21:41 CST 2010


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

Author: Christian Costa <titan.costa at wanadoo.fr>
Date:   Thu Mar  4 08:20:44 2010 +0100

d3dx9_36: Avoid dereferencing null pointers in trace (spotted by Paul Vriens).

---

 dlls/d3dx9_36/shader.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index 9acad32..e4de6b3 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -154,11 +154,13 @@ HRESULT WINAPI D3DXFindShaderComment(CONST DWORD* byte_code, DWORD fourcc, LPCVO
             /* Check if this is the comment we are looking for */
             if (*(ptr + 1) == fourcc)
             {
+                UINT ctab_size = (comment_size - 1) * sizeof(DWORD);
+                LPCVOID ctab_data = ptr + 2;
                 if (size)
-                    *size = (comment_size - 1) * sizeof(DWORD);
+                    *size = ctab_size;
                 if (data)
-                    *data = ptr + 2;
-                TRACE("Returning comment data at %p with size %d\n", *data, *size);
+                    *data = ctab_data;
+                TRACE("Returning comment data at %p with size %d\n", ctab_data, ctab_size);
                 return D3D_OK;
             }
             ptr += comment_size;




More information about the wine-cvs mailing list