1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

ntdll/tests: Fix x86-32 extended context end offset in test_copy_context().

The penultimate element of `ranges_x86` array has an incorrect value: it
should be *at least* 0x2f0, which is the minimum size of an extended
context.

Fix this by setting it to 0x440, which is the minimum size of an
extended context *with* CONTEXT_I386_XSTATE.  This is consistent with
`ranges_amd64`, the penultimate element of which has the minimum size of
an extended context *with* CONTEXT_AMD64_XSTATE.

Note that the incorrect value does not always lead to a test failure,
since check_changes_in_range_() effectively ignores range `start`s that
are not in order.  Reproducing the failure requires a system with a
sufficiently large XSAVE area; specifically, the following condition is
necessary for check_changes_in_range_() to pick up the wrong value:

    0x2cc < 0x294 + src_ex->XState.Length - sizeof(XSTATE).
This commit is contained in:
Jinoh Kang 2024-01-06 21:51:10 +09:00 committed by Alexandre Julliard
parent d56fc6d318
commit 3995ff240a

View file

@ -11848,7 +11848,7 @@ static void test_copy_context(void)
static struct modified_range ranges_x86[] =
{
{0x0, ~0}, {0x4, 0x10}, {0x1c, 0x8}, {0x8c, 0x4}, {0x9c, 0x2}, {0xb4, 0x1}, {0xcc, 0x20}, {0x1ec, 0x80000020},
{0x2cc, ~0}, {0x294, 0}, {0x1000, 0},
{0x2cc, ~0}, {0x440, 0}, {0x1000, 0},
};
static const struct modified_range single_range[] =
{
@ -11963,7 +11963,7 @@ static void test_copy_context(void)
if (flags & CONTEXT_AMD64)
ranges_amd64[ARRAY_SIZE(ranges_amd64) - 2].start = 0x640 + src_ex->XState.Length - sizeof(XSTATE);
else
ranges_x86[ARRAY_SIZE(ranges_x86) - 2].start = 0x294 + src_ex->XState.Length - sizeof(XSTATE);
ranges_x86[ARRAY_SIZE(ranges_x86) - 2].start = 0x440 + src_ex->XState.Length - sizeof(XSTATE);
}
status = pRtlCopyExtendedContext(dst_ex, flags, src_ex);