[wined3d] prevent outof range lookup in DrawStridedSlow - 2

Oliver Stieber oliver_stieber at yahoo.co.uk
Sun Nov 6 19:44:26 CST 2005


--- Oliver Stieber <oliver_stieber at yahoo.co.uk> wrote:

The if (coordIdx > 15) warning is incorrect as generated coordinates can have coordIdx > s that
are much higher, this can be verified by running the fr-025-final2 demo
(http://www.scene.org/file.php?file=/demos/groups/farb-rausch/fr-025-final2.zip&fileinfo)

The attached patch has the (coordIdx > 15) removed.

Oliver.

> Hi.
> 
>    This patch verify that the texture coordinate used in DrawStridedSlow is in
> range before trying to referencing the associated data.
> 
> 
> Oliver.
> 
> 
> 		
> ___________________________________________________________ 
> How much free photo storage do you get? Store your holiday 
> snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com> Files
clean/wine/dlls/wined3d/.device.c.swp and smallpatches/wine/dlls/wined3d/.device.c.swp
> differ
> diff -X ignore -Nru clean/wine/dlls/wined3d/drawprim.c smallpatches/wine/dlls/wined3d/drawprim.c
> --- clean/wine/dlls/wined3d/drawprim.c	2005-10-12 14:14:29.524975000 +0100
> +++ smallpatches/wine/dlls/wined3d/drawprim.c	2005-11-06 23:51:35.664707408 +0000
> @@ -1317,13 +1317,22 @@
>              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));
> +                    if (coordIdx > 15) {
> +                        FIXME("tex: %d - Unexpectdly high texture coord index %d, expect a
> crash.\n", textureNo, coordIdx);
> +                    }
> +                    continue;
> +                } else if (coordIdx < 0) {
> +                    FIXME("tex: %d - Coord index %d is less than zero, expect a crash.\n",
> textureNo, coordIdx);
>                      continue;
> -                } else if (sd->u.s.texCoords[coordIdx].lpData == NULL) {
> +                }
> +
> +                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 {
> > 
> 


		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wined3d-out-of-range-texture-lookup-os-2.patch
Type: text/x-diff
Size: 1598 bytes
Desc: 111494228-wined3d-out-of-range-texture-lookup-os-2.patch
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20051107/2d2cacba/wined3d-out-of-range-texture-lookup-os-2.patch


More information about the wine-patches mailing list