Commit cf40880c authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

dinput: Fix crash in dump_DIEFFECT() when lpvTypeSpecificParams is unexpectedly NULL.

parent 0eaa4335
......@@ -241,34 +241,42 @@ void dump_DIEFFECT(LPCDIEFFECT eff, REFGUID guid, DWORD dwFlags)
if (type == DIEFT_CONSTANTFORCE) {
if (eff->cbTypeSpecificParams != sizeof(DICONSTANTFORCE)) {
WARN("Effect claims to be a constant force but the type-specific params are the wrong size!\n");
} else if (!eff->lpvTypeSpecificParams) {
WARN("Size of type-specific params is correct but pointer is NULL!\n");
} else {
_dump_DICONSTANTFORCE(eff->lpvTypeSpecificParams);
}
} else if (type == DIEFT_PERIODIC) {
if (eff->cbTypeSpecificParams != sizeof(DIPERIODIC)) {
WARN("Effect claims to be a periodic force but the type-specific params are the wrong size!\n");
} else if (!eff->lpvTypeSpecificParams) {
WARN("Size of type-specific params is correct but pointer is NULL!\n");
} else {
_dump_DIPERIODIC(eff->lpvTypeSpecificParams);
}
} else if (type == DIEFT_RAMPFORCE) {
if (eff->cbTypeSpecificParams != sizeof(DIRAMPFORCE)) {
WARN("Effect claims to be a ramp force but the type-specific params are the wrong size!\n");
} else if (!eff->lpvTypeSpecificParams) {
WARN("Size of type-specific params is correct but pointer is NULL!\n");
} else {
_dump_DIRAMPFORCE(eff->lpvTypeSpecificParams);
}
} else if (type == DIEFT_CONDITION) {
if (eff->cbTypeSpecificParams == sizeof(DICONDITION)) {
if (eff->cbTypeSpecificParams == sizeof(DICONDITION) && eff->lpvTypeSpecificParams) {
_dump_DICONDITION(eff->lpvTypeSpecificParams);
} else if (eff->cbTypeSpecificParams == 2 * sizeof(DICONDITION)) {
} else if (eff->cbTypeSpecificParams == 2 * sizeof(DICONDITION) && eff->lpvTypeSpecificParams) {
DICONDITION *condition = eff->lpvTypeSpecificParams;
_dump_DICONDITION(&condition[0]);
_dump_DICONDITION(&condition[1]);
} else {
WARN("Effect claims to be a condition but the type-specific params are the wrong size!\n");
WARN("Effect claims to be a condition but the type-specific params are the wrong size or NULL!\n");
}
} else if (type == DIEFT_CUSTOMFORCE) {
if (eff->cbTypeSpecificParams != sizeof(DICUSTOMFORCE)) {
WARN("Effect claims to be a custom force but the type-specific params are the wrong size!\n");
} else if (!eff->lpvTypeSpecificParams) {
WARN("Size of type-specific params is correct but pointer is NULL!\n");
} else {
_dump_DICUSTOMFORCE(eff->lpvTypeSpecificParams);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment