Module: wine Branch: master Commit: 7386de357f61094d6a32dbd3c0ab8bbed3436f6c URL: http://source.winehq.org/git/wine.git/?a=commit;h=7386de357f61094d6a32dbd3c0...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Thu Aug 20 13:08:07 2015 +0800
ntdll: Do not fail to relocate an image if the size of relocation block is 0.
---
dlls/ntdll/loader.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 4404938..8a43310 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1680,14 +1680,16 @@ static NTSTATUS perform_relocations( void *module, SIZE_T len )
relocs = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
- if ((nt->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) || - !relocs->VirtualAddress || !relocs->Size) + if (nt->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) { WARN( "Need to relocate module from %p to %p, but there are no relocation records\n", base, module ); 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])) return STATUS_INVALID_IMAGE_FORMAT;