Ignore relocations for unmapped pages.

This commit is contained in:
Alexandre Julliard 2005-09-21 09:47:12 +00:00
parent c818a4e662
commit 489c6b3865
1 changed files with 9 additions and 3 deletions

View File

@ -780,8 +780,7 @@ static int do_relocations( char *base, const IMAGE_DATA_DIRECTORY *dir,
if (!count) continue; if (!count) continue;
/* sanity checks */ /* sanity checks */
if ((char *)rel + rel->SizeOfBlock > base + dir->VirtualAddress + dir->Size || if ((char *)rel + rel->SizeOfBlock > base + dir->VirtualAddress + dir->Size)
page > base + total_size)
{ {
ERR_(module)("invalid relocation %p,%lx,%ld at %p,%lx,%lx\n", ERR_(module)("invalid relocation %p,%lx,%ld at %p,%lx,%lx\n",
rel, rel->VirtualAddress, rel->SizeOfBlock, rel, rel->VirtualAddress, rel->SizeOfBlock,
@ -789,7 +788,14 @@ static int do_relocations( char *base, const IMAGE_DATA_DIRECTORY *dir,
return 0; return 0;
} }
TRACE_(module)("%ld relocations for page %lx\n", rel->SizeOfBlock, rel->VirtualAddress); if (page > base + total_size)
{
WARN_(module)("skipping %d relocations for page %p beyond module %p-%p\n",
count, page, base, base + total_size );
continue;
}
TRACE_(module)("%d relocations for page %lx\n", count, rel->VirtualAddress);
/* patching in reverse order */ /* patching in reverse order */
for (i = 0 ; i < count; i++) for (i = 0 ; i < count; i++)