d3dx9_36/tests: Avoid a potential out of bound access.

This commit is contained in:
Nozomi Kodama 2012-10-02 14:12:27 +08:00 committed by Alexandre Julliard
parent 584c24050e
commit 9c823d04b6
1 changed files with 2 additions and 2 deletions

View File

@ -2818,10 +2818,10 @@ static void test_D3DXSHRotateZ(void)
{ {
/* order = 0 or order = 1 behaves like order = D3DXSH_MINORDER */ /* order = 0 or order = 1 behaves like order = D3DXSH_MINORDER */
square = ( order <= D3DXSH_MINORDER ) ? D3DXSH_MINORDER * D3DXSH_MINORDER : order * order; square = ( order <= D3DXSH_MINORDER ) ? D3DXSH_MINORDER * D3DXSH_MINORDER : order * order;
expected = table[36 * j + i];
if ( i >= square || ( (order >= D3DXSH_MAXORDER) && ( i >= D3DXSH_MAXORDER * D3DXSH_MAXORDER ) ) ) if ( i >= square || ( (order >= D3DXSH_MAXORDER) && ( i >= D3DXSH_MAXORDER * D3DXSH_MAXORDER ) ) )
expected = ( i + 1.0f ) * ( i + 1.0f ); expected = ( i + 1.0f ) * ( i + 1.0f );
else
expected = table[36 * j + i];
ok(relative_error(out[i], expected) < admitted_error, "angle %f, order %u index %u, Expected %f, received %f\n", angle[j], order, i, expected, out[i]); ok(relative_error(out[i], expected) < admitted_error, "angle %f, order %u index %u, Expected %f, received %f\n", angle[j], order, i, expected, out[i]);
} }
} }