MAX_PALETTE limit check (take 2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

The old patch was incomplete, better apply this one.
Actually there is defined 256 palettes, commandos 3
needs 512, but gta3 a bigger number.

Changelog
                                                                                
Checked that don't write out of the range of palettes
defined.

Regards,
Carlos.

-- 
 ___         _          \  |  /  Consulting
| . |._ _  _| | ___  ___  ___    http://www.andago.com
|   || ' |/ . |<_> |/ . |/ . \__ GNU/Linux
|_|_||_|_|\___|<___|\_. |\___/     _ \  __|\ \  /
 Carlos A. Lozano   <___'/ | \ -_) __/\__ \ >  <  -_)
 [ carlos.lozano@andago.com ]\___|_|  ____/ _/\_\___|
 [ calb@epsxe.com           ]  http://www.epsxe.com
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	1 Nov 2003 11:35:03 -0000
@@ -3585,11 +3585,17 @@
     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;
 }
 HRESULT  WINAPI  IDirect3DDevice8Impl_GetPaletteEntries(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber, PALETTEENTRY* pEntries) {
     ICOM_THIS(IDirect3DDevice8Impl,iface);
+    if (PaletteNumber >= MAX_PALETTES) {
+        return D3DERR_INVALIDCALL;
+    }
     memcpy(pEntries, This->palettes[PaletteNumber], 256 * sizeof(PALETTEENTRY));
     FIXME("(%p) : returning p[%u] => RGBA(%02x,%02x,%02x,%02x)\n", This, PaletteNumber,
           pEntries->peRed, pEntries->peGreen, pEntries->peBlue, pEntries->peFlags);
@@ -3598,6 +3604,9 @@
 HRESULT  WINAPI  IDirect3DDevice8Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber) {
     ICOM_THIS(IDirect3DDevice8Impl,iface);
     FIXME("(%p) : Setting to (%u)\n", This, PaletteNumber);
+    if (PaletteNumber >= MAX_PALETTES) {
+        return D3DERR_INVALIDCALL;
+    }
     This->currentPalette = PaletteNumber;
 
 #if defined(GL_EXT_paletted_texture)

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux