wine/dlls/wined3d drawprim.c

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 7 05:13:26 CST 2005


ChangeSet ID:	21134
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/07 05:13:26

Modified files:
	dlls/wined3d   : drawprim.c 

Log message:
	Oliver Stieber <oliver_stieber at yahoo.co.uk>
	Verify that the texture coordinate used in DrawStridedSlow is in range
	before trying to referencing the associated data.

Patch: http://cvs.winehq.org/patch.py?id=21134

Old revision  New revision  Changes     Path
 1.31          1.32          +8 -2       wine/dlls/wined3d/drawprim.c

Index: wine/dlls/wined3d/drawprim.c
diff -u -p wine/dlls/wined3d/drawprim.c:1.31 wine/dlls/wined3d/drawprim.c:1.32
--- wine/dlls/wined3d/drawprim.c:1.31	7 Nov 2005 11:13:26 -0000
+++ wine/dlls/wined3d/drawprim.c	7 Nov 2005 11:13:26 -0000
@@ -1317,13 +1317,19 @@ static void drawStridedSlow(IWineD3DDevi
             if (This->stateBlock->textures[textureNo] != NULL) {
 
                 int    coordIdx = This->stateBlock->textureState[textureNo][D3DTSS_TEXCOORDINDEX];
-                float *ptrToCoords = (float *)(sd->u.s.texCoords[coordIdx].lpData + (SkipnStrides * sd->u.s.texCoords[coordIdx].dwStride));
+                float *ptrToCoords = NULL;
                 float  s = 0.0, t = 0.0, r = 0.0, q = 0.0;
 
                 if (coordIdx > 7) {
                     VTRACE(("tex: %d - Skip tex coords, as being system generated\n", textureNo));
                     continue;
-                } else if (sd->u.s.texCoords[coordIdx].lpData == NULL) {
+                } else if (coordIdx < 0) {
+                    FIXME("tex: %d - Coord index %d is less than zero, expect a crash.\n", textureNo, coordIdx);
+                    continue;
+                }
+
+                ptrToCoords = (float *)(sd->u.s.texCoords[coordIdx].lpData + (SkipnStrides * sd->u.s.texCoords[coordIdx].dwStride));
+                if (sd->u.s.texCoords[coordIdx].lpData == NULL) {
                     TRACE("tex: %d - Skipping tex coords, as no data supplied\n", textureNo);
                     continue;
                 } else {



More information about the wine-cvs mailing list