Rémi Bernon : dinput: Check that DIPROP_RANGE lMin and lMax are ordered.
Alexandre Julliard
julliard at winehq.org
Tue Sep 28 16:01:56 CDT 2021
Module: wine
Branch: master
Commit: 844db6e53e86ccc5fdf55d44c791a5541ddf8cb8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=844db6e53e86ccc5fdf55d44c791a5541ddf8cb8
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Tue Sep 28 09:30:10 2021 +0200
dinput: Check that DIPROP_RANGE lMin and lMax are ordered.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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;
More information about the wine-cvs
mailing list