Ignore:
Timestamp:
Jun 26, 2000, 2:23:54 PM (25 years ago)
Author:
sandervl
Message:

fix for fixup crash in vaj

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/winimagepeldr.cpp

    r3678 r3757  
    1 /* $Id: winimagepeldr.cpp,v 1.47 2000-06-08 18:08:57 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.48 2000-06-26 12:23:54 sandervl Exp $ */
    22
    33/*
     
    105105    imageVirtBase(-1), realBaseAddress(0), imageVirtEnd(0),
    106106    nrNameExports(0), nrOrdExports(0), nameexports(NULL), ordexports(NULL),
    107     memmap(NULL), pFixups(NULL)
     107    memmap(NULL), pFixups(NULL), dwFixupSize(0)
    108108{
    109109 HFILE  dllfile;
     
    464464
    465465   if(realBaseAddress != oh.ImageBase) {
    466         pFixups = (PIMAGE_BASE_RELOCATION)ImageDirectoryOffset(win32file, IMAGE_DIRECTORY_ENTRY_BASERELOC);
     466        pFixups     = (PIMAGE_BASE_RELOCATION)ImageDirectoryOffset(win32file, IMAGE_DIRECTORY_ENTRY_BASERELOC);
     467        dwFixupSize = ImageDirectorySize(win32file, IMAGE_DIRECTORY_ENTRY_BASERELOC);
    467468        commitPage((ULONG)pFixups, FALSE);
    468469   }
     
    621622                return FALSE;
    622623        }
    623         if(realBaseAddress != oh.ImageBase) {
    624                 setFixups(virtAddress, sectionsize);
    625         }
     624        setFixups(virtAddress, sectionsize);
    626625
    627626        rc = DosSetMem((PVOID)virtAddress, sectionsize, protflags);
     
    637636                return FALSE;
    638637        }
    639         if(realBaseAddress != oh.ImageBase) {
    640                 setFixups(virtAddress, sectionsize);
    641         }
     638        setFixups(virtAddress, sectionsize);
     639
    642640        rc = DosSetMem((PVOID)virtAddress, sectionsize, protflags);
    643641        if(rc) {
     
    872870 PIMAGE_BASE_RELOCATION prel = pFixups;
    873871
    874   if(fh.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) {
     872  if(realBaseAddress == oh.ImageBase || fh.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) {
    875873        return(TRUE);
    876874  }
     
    883881  if(prel) {
    884882        j = 1;
    885         while(prel->VirtualAddress && prel->VirtualAddress < virtAddress) {
     883        while(((ULONG)prel < (ULONG)pFixups+dwFixupSize) &&
     884              prel->VirtualAddress && prel->VirtualAddress < virtAddress)
     885        {
    886886                prel = (PIMAGE_BASE_RELOCATION)((char*)prel + prel->SizeOfBlock);
    887887        }
    888         while(prel->VirtualAddress && prel->VirtualAddress < virtAddress + size) {
     888        while(((ULONG)prel < (ULONG)pFixups+dwFixupSize) &&
     889              prel->VirtualAddress && prel->VirtualAddress < virtAddress + size)
     890        {
    889891                page = (char *)((char *)prel + (ULONG)prel->VirtualAddress);
    890892                count  = (prel->SizeOfBlock - 8)/2;
Note: See TracChangeset for help on using the changeset viewer.