Commit 29894e1c authored by Ivo Ivanov's avatar Ivo Ivanov Committed by Alexandre Julliard

dinput: Prevent a potential array overflow error during the conversion from…

dinput: Prevent a potential array overflow error during the conversion from spherical to Cartesian coordinates. Signed-off-by: 's avatarIvo Ivanov <logos128@gmail.com>
parent 1cf1412a
...@@ -2350,6 +2350,7 @@ static void convert_directions_from_spherical( const DIEFFECT *in, DIEFFECT *out ...@@ -2350,6 +2350,7 @@ static void convert_directions_from_spherical( const DIEFFECT *in, DIEFFECT *out
tmp = cos( in->rglDirection[i - 1] * M_PI / 18000 ) * 10000; tmp = cos( in->rglDirection[i - 1] * M_PI / 18000 ) * 10000;
for (j = 0; j < i; ++j) for (j = 0; j < i; ++j)
out->rglDirection[j] = round( out->rglDirection[j] * tmp / 10000.0 ); out->rglDirection[j] = round( out->rglDirection[j] * tmp / 10000.0 );
if (i < in->cAxes)
out->rglDirection[i] = sin( in->rglDirection[i - 1] * M_PI / 18000 ) * 10000; out->rglDirection[i] = sin( in->rglDirection[i - 1] * M_PI / 18000 ) * 10000;
} }
out->cAxes = in->cAxes; out->cAxes = in->cAxes;
......
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