https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1f6645eb19049bdc9efe4b69321932ec972514ed

commit 1f6645eb19049bdc9efe4b69321932ec972514ed
Author:     winesync <[email protected]>
AuthorDate: Tue Jan 5 13:16:39 2021 +0100
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Thu Feb 4 16:37:07 2021 +0100

    [WINESYNC] d3dx9: Correctly handle sprites array reallocation.
    
    Signed-off-by: Matteo Bruni <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 34c0055cfcb84e32d13556b7ec841d01acf5fe96 by Matteo Bruni 
<[email protected]>
---
 dll/directx/wine/d3dx9_36/sprite.c | 10 +++++++---
 sdk/tools/winesync/d3dx9.cfg       |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dll/directx/wine/d3dx9_36/sprite.c 
b/dll/directx/wine/d3dx9_36/sprite.c
index c47b6a12be0..71cc5867f6d 100644
--- a/dll/directx/wine/d3dx9_36/sprite.c
+++ b/dll/directx/wine/d3dx9_36/sprite.c
@@ -346,6 +346,7 @@ static HRESULT WINAPI d3dx9_sprite_Draw(ID3DXSprite *iface, 
IDirect3DTexture9 *t
         const RECT *rect, const D3DXVECTOR3 *center, const D3DXVECTOR3 
*position, D3DCOLOR color)
 {
     struct d3dx9_sprite *This = impl_from_ID3DXSprite(iface);
+    struct sprite *new_sprites;
     D3DSURFACE_DESC texdesc;
 
     TRACE("iface %p, texture %p, rect %s, center %p, position %p, color 
0x%08x.\n",
@@ -361,9 +362,12 @@ static HRESULT WINAPI d3dx9_sprite_Draw(ID3DXSprite 
*iface, IDirect3DTexture9 *t
     }
     else if (This->allocated_sprites <= This->sprite_count)
     {
-        This->allocated_sprites += This->allocated_sprites / 2;
-        This->sprites = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-                This->sprites, This->allocated_sprites * 
sizeof(*This->sprites));
+        new_sprites = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+                This->sprites, This->allocated_sprites * 2 * 
sizeof(*This->sprites));
+        if (!new_sprites)
+            return E_OUTOFMEMORY;
+        This->sprites = new_sprites;
+        This->allocated_sprites *= 2;
     }
     This->sprites[This->sprite_count].texture=texture;
     if(!(This->flags & D3DXSPRITE_DO_NOT_ADDREF_TEXTURE))
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 8e43f742f2f..9ff89d183a5 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -34,4 +34,4 @@ files:
   include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h
   include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h
 tags:
-  wine: a097f54ea1e7e75b78842ceb835f5db5f08fea06
+  wine: 34c0055cfcb84e32d13556b7ec841d01acf5fe96

Reply via email to