Nikolay Sivov : d3d10/effect: Validate flags vs pool instance when creating child effects.
Alexandre Julliard
julliard at winehq.org
Mon Sep 20 16:26:19 CDT 2021
Module: wine
Branch: master
Commit: de49664d06d24e961e823aeca26643ee237426d0
URL: https://source.winehq.org/git/wine.git/?a=commit;h=de49664d06d24e961e823aeca26643ee237426d0
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu Sep 16 09:48:11 2021 +0300
d3d10/effect: Validate flags vs pool instance when creating child effects.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d10/effect.c | 3 +++
dlls/d3d10/tests/effect.c | 6 ------
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index a2595aac136..c757b82a529 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -8443,6 +8443,9 @@ HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT fl
FIXME("data %p, data_size %lu, flags %#x, device %p, effect_pool %p, effect %p stub!\n",
data, data_size, flags, device, effect_pool, effect);
+ if (!(flags & D3D10_EFFECT_COMPILE_CHILD_EFFECT) != !effect_pool)
+ return E_INVALIDARG;
+
if (FAILED(hr = d3d10_create_effect(data, data_size, device, &d3d10_effect_vtbl, &object)))
{
WARN("Failed to create an effect, hr %#x.\n", hr);
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c
index 97331c2135e..2ca78194d6a 100644
--- a/dlls/d3d10/tests/effect.c
+++ b/dlls/d3d10/tests/effect.c
@@ -6486,9 +6486,7 @@ todo_wine
/* Create standalone effect from the same blob used for pool, */
hr = create_effect(fx_test_pool, D3D10_EFFECT_COMPILE_CHILD_EFFECT, device, NULL, &child_effect);
-todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
- if (SUCCEEDED(hr)) child_effect->lpVtbl->Release(child_effect);
hr = create_effect(fx_test_pool, 0, device, NULL, &effect2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@@ -6564,14 +6562,10 @@ todo_wine
/* When pool is specified, corresponding flag has to be set. */
hr = create_effect(fx_test_pool_child, 0, device, pool, &child_effect);
-todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
- if (SUCCEEDED(hr)) child_effect->lpVtbl->Release(child_effect);
hr = create_effect(fx_test_pool_child, D3D10_EFFECT_COMPILE_CHILD_EFFECT, device, NULL, &child_effect);
-todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
- if (SUCCEEDED(hr)) child_effect->lpVtbl->Release(child_effect);
refcount = get_refcount(pool);
ok(refcount == 1, "Unexpected refcount %u.\n", refcount);
More information about the wine-cvs
mailing list