Commit 7386de35 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

ntdll: Do not fail to relocate an image if the size of relocation block is 0.

parent 3b5107d0
...@@ -1680,14 +1680,16 @@ static NTSTATUS perform_relocations( void *module, SIZE_T len ) ...@@ -1680,14 +1680,16 @@ static NTSTATUS perform_relocations( void *module, SIZE_T len )
relocs = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC]; relocs = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
if ((nt->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) || if (nt->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED)
!relocs->VirtualAddress || !relocs->Size)
{ {
WARN( "Need to relocate module from %p to %p, but there are no relocation records\n", WARN( "Need to relocate module from %p to %p, but there are no relocation records\n",
base, module ); base, module );
return STATUS_CONFLICTING_ADDRESSES; return STATUS_CONFLICTING_ADDRESSES;
} }
if (!relocs->Size) return STATUS_SUCCESS;
if (!relocs->VirtualAddress) return STATUS_CONFLICTING_ADDRESSES;
if (nt->FileHeader.NumberOfSections > sizeof(protect_old)/sizeof(protect_old[0])) if (nt->FileHeader.NumberOfSections > sizeof(protect_old)/sizeof(protect_old[0]))
return STATUS_INVALID_IMAGE_FORMAT; return STATUS_INVALID_IMAGE_FORMAT;
......
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