Module: wine Branch: master Commit: 3995ff240a8c1ab4ead764df4dd31b0bda2d6e63 URL: https://gitlab.winehq.org/wine/wine/-/commit/3995ff240a8c1ab4ead764df4dd31b0...
Author: Jinoh Kang jinoh.kang.kr@gmail.com Date: Sat Jan 6 21:51:10 2024 +0900
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).
---
dlls/ntdll/tests/exception.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index bac571b2733..79a65dadab9 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -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);