wined3d: Fix crash caused by bad TRACE

Jason Green jave27 at gmail.com
Wed Jul 26 01:25:07 CDT 2006


If the coordinate index is greater than MAX_TEXTURES, then the lookup
into the strided data array causes a crash.  This patch moves the
trace to where the texture is actually being setup.

Not sure when this bug showed up, but I've recently had a few apps
randomly crash on me, and this was the cause.
-------------- next part --------------
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index bb48982..a7dd644 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -1145,7 +1145,6 @@ #endif
 
         if (This->stateBlock->textures[textureNo] != NULL) {
             int coordIdx = This->stateBlock->textureState[textureNo][D3DTSS_TEXCOORDINDEX];
-            TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n", textureNo, texture_idx, coordIdx, sd->u.s.texCoords[coordIdx].lpData);
 
             if (coordIdx >= MAX_TEXTURES) {
                 VTRACE(("tex: %d - Skip tex coords, as being system generated\n", textureNo));
@@ -1158,6 +1157,8 @@ #endif
                 GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + texture_idx, 0, 0, 0, 1));
 
             } else {
+                TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n",
+                      textureNo, texture_idx, coordIdx, sd->u.s.texCoords[coordIdx].lpData);
                 if(curVBO != sd->u.s.texCoords[coordIdx].VBO) {
                     GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, sd->u.s.texCoords[coordIdx].VBO));
                     checkGLcall("glBindBufferARB");


More information about the wine-patches mailing list