=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: ddraw: Fix D3DEXECUTEDATA.dwSize handling.

Alexandre Julliard julliard at winehq.org
Mon Apr 9 15:41:09 CDT 2018


Module: wine
Branch: master
Commit: 6f5028337e6f3e1712bafaaa1a0a3bfb983850a3
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6f5028337e6f3e1712bafaaa1a0a3bfb983850a3

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Thu Apr  5 12:59:13 2018 +0200

ddraw: Fix D3DEXECUTEDATA.dwSize handling.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ddraw/executebuffer.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c
index 497287e..89d9ed3 100644
--- a/dlls/ddraw/executebuffer.c
+++ b/dlls/ddraw/executebuffer.c
@@ -610,6 +610,12 @@ static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *
 
     TRACE("iface %p, data %p.\n", iface, data);
 
+    if (data->dwSize != sizeof(*data))
+    {
+        WARN("data->dwSize is %u, returning DDERR_INVALIDPARAMS.\n", data->dwSize);
+        return DDERR_INVALIDPARAMS;
+    }
+
     /* Skip past previous vertex data. */
     buffer->src_vertex_pos += buffer->data.dwVertexCount;
 
@@ -693,12 +699,11 @@ static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *
 static HRESULT WINAPI d3d_execute_buffer_GetExecuteData(IDirect3DExecuteBuffer *iface, D3DEXECUTEDATA *data)
 {
     struct d3d_execute_buffer *buffer = impl_from_IDirect3DExecuteBuffer(iface);
-    DWORD dwSize;
 
     TRACE("iface %p, data %p.\n", iface, data);
 
-    dwSize = data->dwSize;
-    memcpy(data, &buffer->data, dwSize);
+    /* Tests show that dwSize is ignored. */
+    memcpy(data, &buffer->data, sizeof(*data));
 
     if (TRACE_ON(ddraw))
     {




More information about the wine-cvs mailing list