VirtualBox

Changeset 3022

Show
Ignore:
Timestamp:
06/04/07 14:32:29 (2 years ago)
Author:
vboxsync
Message:

Check that there is a symbol table in the ELF relocatable image we're loading. (or we'll crash later during relocalation)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/iprt/err.h

    r3004 r3022  
    786786#define VERR_LDRELF_INVALID_SYMBOL_NAME_OFFSET  (-638) 
    787787/** The ELF loader encountered an invalid relocation offset. */ 
    788 #define VERR_ELFLDR_INVALID_RELOCATION_OFFSET   (-639) 
     788#define VERR_LDRELF_INVALID_RELOCATION_OFFSET   (-639) 
     789/** The ELF loader didn't find the symbol/string table for the image. */ 
     790#define VERR_LDRELF_NO_SYMBOL_OR_NO_STRING_TABS (-640) 
    789791/** @}*/ 
    790792 
  • trunk/src/VBox/Runtime/ldrELFRelocatable.cpp.h

    r2981 r3022  
    283283         * Apply the fixup. 
    284284         */ 
    285         AssertMsgReturn(paRels[iRel].r_offset < cbSec, (FMT_ELF_ADDR " " FMT_ELF_SIZE "\n", paRels[iRel].r_offset, cbSec), VERR_ELFLDR_INVALID_RELOCATION_OFFSET); 
     285        AssertMsgReturn(paRels[iRel].r_offset < cbSec, (FMT_ELF_ADDR " " FMT_ELF_SIZE "\n", paRels[iRel].r_offset, cbSec), VERR_LDRELF_INVALID_RELOCATION_OFFSET); 
    286286#if   ELF_MODE == 32 
    287287        const Elf_Addr *pAddrR = (const Elf_Addr *)(pu8SecBaseR + paRels[iRel].r_offset);    /* Where to read the addend. */ 
     
    10701070                /* 
    10711071                 * Are the section headers fine? 
     1072                 * We require there to be symbol & string tables (at least for the time being). 
    10721073                 */ 
     1074                if (    pModElf->iSymSh == ~0U 
     1075                    ||  pModElf->iStrSh == ~0U) 
     1076                    rc = VERR_LDRELF_NO_SYMBOL_OR_NO_STRING_TABS; 
    10731077                if (RT_SUCCESS(rc)) 
    10741078                { 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy