ntdll/tests: Fix incorrect calculation of context length in test_copy_context().
`(BYTE *)dst_ex - (BYTE *)dst` is the size of the legacy context, but `dst_ex->All` already contains the legacy context. Therefore, `context_length` has the legacy context size added *twice*. This becomes a problem when `context_length` exceeds `sizeof(src_context_buffer)`. This confuses `check_changes_in_range()`, causing out-of-bounds read and unpredictable test results.
This commit is contained in:
parent
3995ff240a
commit
7ba9dea999
1 changed files with 1 additions and 1 deletions
|
@ -11952,7 +11952,7 @@ static void test_copy_context(void)
|
|||
*(DWORD *)((BYTE *)dst + flags_offset) = 0;
|
||||
*(DWORD *)((BYTE *)src + flags_offset) = 0;
|
||||
|
||||
context_length = (BYTE *)dst_ex - (BYTE *)dst + dst_ex->All.Length;
|
||||
context_length = dst_ex->All.Length;
|
||||
|
||||
if (flags & 0x40)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue