Commit 7f4e5b1e authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Don't crash on empty table in RtlAddFunctionTable().

parent 9b0e1f0b
......@@ -3458,7 +3458,7 @@ BOOLEAN CDECL RtlAddFunctionTable( RUNTIME_FUNCTION *table, DWORD count, DWORD64
return FALSE;
entry->base = addr;
entry->end = addr + table[count - 1].EndAddress;
entry->end = addr + (count ? table[count - 1].EndAddress : 0);
entry->table = table;
entry->count = count;
entry->max_count = 0;
......
......@@ -2103,6 +2103,14 @@ static void test_dynamic_unwind(void)
ok( !pRtlDeleteFunctionTable( runtime_func ),
"RtlDeleteFunctionTable returned success for nonexistent table runtime_func = %p\n", runtime_func );
/* Empty table */
ok( pRtlAddFunctionTable( runtime_func, 0, (ULONG_PTR)code_mem ),
"RtlAddFunctionTable failed for empty table\n" );
ok( pRtlDeleteFunctionTable( runtime_func ),
"RtlDeleteFunctionTable failed for empty table\n" );
ok( !pRtlDeleteFunctionTable( runtime_func ),
"RtlDeleteFunctionTable succeeded twice for empty table\n" );
/* Test RtlInstallFunctionTableCallback with both low bits unset */
table = (ULONG_PTR)code_mem;
ok( !pRtlInstallFunctionTableCallback( table, (ULONG_PTR)code_mem, code_offset + 32, &dynamic_unwind_callback, (PVOID*)&count, NULL ),
......
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