Commit 0bb48fcb authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Avoid invalid rglDirection access when effect cAxes is 0.

parent 71d0cdde
...@@ -2296,7 +2296,7 @@ static void convert_directions_to_spherical( const DIEFFECT *in, DIEFFECT *out ) ...@@ -2296,7 +2296,7 @@ static void convert_directions_to_spherical( const DIEFFECT *in, DIEFFECT *out )
tmp = atan2( in->rglDirection[i], tmp ); tmp = atan2( in->rglDirection[i], tmp );
out->rglDirection[i - 1] = tmp * 18000 / M_PI; out->rglDirection[i - 1] = tmp * 18000 / M_PI;
} }
out->rglDirection[in->cAxes - 1] = 0; if (in->cAxes) out->rglDirection[in->cAxes - 1] = 0;
out->cAxes = in->cAxes; out->cAxes = in->cAxes;
break; break;
case DIEFF_POLAR: case DIEFF_POLAR:
...@@ -2306,7 +2306,8 @@ static void convert_directions_to_spherical( const DIEFFECT *in, DIEFFECT *out ) ...@@ -2306,7 +2306,8 @@ static void convert_directions_to_spherical( const DIEFFECT *in, DIEFFECT *out )
out->cAxes = in->cAxes; out->cAxes = in->cAxes;
break; break;
case DIEFF_SPHERICAL: case DIEFF_SPHERICAL:
for (i = 0; i < in->cAxes - 1; ++i) if (!in->cAxes) i = 0;
else for (i = 0; i < in->cAxes - 1; ++i)
{ {
out->rglDirection[i] = in->rglDirection[i] % 36000; out->rglDirection[i] = in->rglDirection[i] % 36000;
if (out->rglDirection[i] < 0) out->rglDirection[i] += 36000; if (out->rglDirection[i] < 0) out->rglDirection[i] += 36000;
......
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