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

Alexandre Julliard julliard at winehq.org
Tue Jun 26 04:44:28 CDT 2018


Module: wine
Branch: stable
Commit: 44c8b8b76fcc1c6ee9f65383a658519308e3f494
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=44c8b8b76fcc1c6ee9f65383a658519308e3f494

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>
(cherry picked from commit 6f5028337e6f3e1712bafaaa1a0a3bfb983850a3)
Signed-off-by: Michael Stefaniuc <mstefani 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 ea5a55c..c002f81 100644
--- a/dlls/ddraw/executebuffer.c
+++ b/dlls/ddraw/executebuffer.c
@@ -604,6 +604,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;
 
@@ -680,12 +686,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