[PATCH 3/8] dinput: Check that DIPROP_RANGE lMin and lMax are ordered.
Rémi Bernon
rbernon at codeweavers.com
Tue Sep 28 02:30:10 CDT 2021
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/dinput/joystick_hid.c | 4 ++++
dlls/dinput8/tests/hid.c | 1 -
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index b4ccbd9f509..6d70e188dbe 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -607,9 +607,13 @@ static HRESULT WINAPI hid_joystick_SetProperty( IDirectInputDevice8W *iface, con
switch (LOWORD( guid ))
{
case (DWORD_PTR)DIPROP_RANGE:
+ {
+ DIPROPRANGE *value = (DIPROPRANGE *)header;
if (header->dwSize != sizeof(DIPROPRANGE)) return DIERR_INVALIDPARAM;
+ if (value->lMin > value->lMax) return DIERR_INVALIDPARAM;
enum_objects( impl, header, DIDFT_AXIS, set_property_prop_range, (void *)header );
return DI_OK;
+ }
case (DWORD_PTR)DIPROP_FFLOAD:
case (DWORD_PTR)DIPROP_GRANULARITY:
case (DWORD_PTR)DIPROP_VIDPID:
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index 41f6d5316b5..0270467dea8 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -4275,7 +4275,6 @@ static void test_simple_joystick(void)
prop_range.lMin = -4000;
prop_range.lMax = -14000;
hr = IDirectInputDevice8_SetProperty( device, DIPROP_RANGE, &prop_range.diph );
- todo_wine
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SetProperty DIPROP_RANGE returned %#x\n", hr );
prop_range.lMin = -14000;
prop_range.lMax = -4000;
--
2.33.0
More information about the wine-devel
mailing list