added check for MIPS machine type in the 'readElfHeader' method

svn-id: r51403
This commit is contained in:
Tony Puccinelli 2010-07-28 05:18:46 +00:00
parent ff78cf6771
commit 9d236ac4d0
2 changed files with 9 additions and 0 deletions

View file

@ -93,7 +93,12 @@ bool DLObject::readElfHeader(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehd
if (DLFile->read(ehdr, sizeof(*ehdr)) != sizeof(*ehdr) || if (DLFile->read(ehdr, sizeof(*ehdr)) != sizeof(*ehdr) ||
memcmp(ehdr->e_ident, ELFMAG, SELFMAG) || // Check MAGIC memcmp(ehdr->e_ident, ELFMAG, SELFMAG) || // Check MAGIC
ehdr->e_type != ET_EXEC || // Check for executable ehdr->e_type != ET_EXEC || // Check for executable
#ifdef ARM_TARGET
ehdr->e_machine != EM_ARM || // Check for ARM machine type ehdr->e_machine != EM_ARM || // Check for ARM machine type
#endif
#ifdef MIPS_TARGET
ehdr->e_machine != EM_MIPS ||
#endif
ehdr->e_phentsize < sizeof(Elf32_Phdr) || // Check for size of program header ehdr->e_phentsize < sizeof(Elf32_Phdr) || // Check for size of program header
ehdr->e_shentsize != sizeof(Elf32_Shdr)) { // Check for size of section header ehdr->e_shentsize != sizeof(Elf32_Shdr)) { // Check for size of section header
seterror("Invalid file type."); seterror("Invalid file type.");

View file

@ -34,6 +34,10 @@
#include "shorts-segment-manager.h" #include "shorts-segment-manager.h"
#endif #endif
#if defined(__DS__)
#define ARM_TARGET
#endif
#define MAXDLERRLEN 80 #define MAXDLERRLEN 80
class DLObject { class DLObject {