MAX_PALETTE limit check

Carlos Lozano clozano at andago.com
Fri Oct 31 10:49:13 CST 2003


Changelog

Checked that don't write out of the range of palettes
defined. 
(Fixes the commandos 3 demo, hmm, maybe that a longer
number of palettes is necessary?)

Regards,
Carlos.

-- 
 ___         _          \  |  /  Consulting
| . |._ _  _| | ___  ___  ___    http://www.andago.com
|   || ' |/ . |<_> |/ . |/ . \__ GNU/Linux
|_|_||_|_|\___|<___|\_. |\___/     _ \  __|\ \  /
 Carlos A. Lozano   <___'/ | \ -_) __/\__ \ >  <  -_)
 [ carlos.lozano at andago.com ]\___|_|  ____/ _/\_\___|
 [ calb at epsxe.com           ]  http://www.epsxe.com
-------------- next part --------------
Index: dlls/d3d8/device.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/device.c,v
retrieving revision 1.90
diff -u -r1.90 device.c
--- dlls/d3d8/device.c	31 Oct 2003 04:15:07 -0000	1.90
+++ dlls/d3d8/device.c	31 Oct 2003 16:44:18 -0000
@@ -3585,6 +3585,9 @@
     ICOM_THIS(IDirect3DDevice8Impl,iface);
     FIXME("(%p) : setting p[%u] <= RGBA(%02x,%02x,%02x,%02x)\n", This, PaletteNumber,
           pEntries->peRed, pEntries->peGreen, pEntries->peBlue, pEntries->peFlags);
+    if (PaletteNumber >= MAX_PALETTES) {
+        return D3DERR_INVALIDCALL;
+    }
     memcpy(This->palettes[PaletteNumber], pEntries, 256 * sizeof(PALETTEENTRY));
     return D3D_OK;
 }


More information about the wine-patches mailing list