From b60903306fd1b9563a7f02c23197893a55bfa3b7 Mon Sep 17 00:00:00 2001 From: nemerle Date: Thu, 19 May 2016 16:17:08 +0200 Subject: [PATCH] Fix memset-of-non-POD bug. PROG contains vector, but was memset. --- include/BinaryImage.h | 28 ++++++++++++++-------------- src/project.cpp | 1 - 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/include/BinaryImage.h b/include/BinaryImage.h index e713633..18872a5 100644 --- a/include/BinaryImage.h +++ b/include/BinaryImage.h @@ -3,21 +3,21 @@ #include struct PROG /* Loaded program image parameters */ { - int16_t initCS; - int16_t initIP; /* These are initial load values */ - int16_t initSS; /* Probably not of great interest */ - uint16_t initSP; - bool fCOM; /* Flag set if COM program (else EXE)*/ - int cReloc; /* No. of relocation table entries */ + int16_t initCS=0; + int16_t initIP=0; /* These are initial load values */ + int16_t initSS=0; /* Probably not of great interest */ + uint16_t initSP=0; + bool fCOM=false; /* Flag set if COM program (else EXE)*/ + int cReloc=0; /* No. of relocation table entries */ std::vector relocTable; /* Ptr. to relocation table */ - uint8_t * map; /* Memory bitmap ptr */ - int cProcs; /* Number of procedures so far */ - int offMain; /* The offset of the main() proc */ - uint16_t segMain; /* The segment of the main() proc */ - bool bSigs; /* True if signatures loaded */ - int cbImage; /* Length of image in bytes */ - uint8_t * Imagez; /* Allocated by loader to hold entire program image */ - int addressingMode; + uint8_t * map=nullptr; /* Memory bitmap ptr */ + int cProcs=0; /* Number of procedures so far */ + int offMain=0; /* The offset of the main() proc */ + uint16_t segMain=0; /* The segment of the main() proc */ + bool bSigs=false; /* True if signatures loaded */ + int cbImage=0; /* Length of image in bytes */ + uint8_t * Imagez=nullptr; /* Allocated by loader to hold entire program image */ + int addressingMode=0; public: const uint8_t *image() const {return Imagez;} void displayLoadInfo(); diff --git a/src/project.cpp b/src/project.cpp index 6072b6d..ece5f4e 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -15,7 +15,6 @@ OPTION option; /* Command line options */ Project *Project::s_instance = nullptr; Project::Project() : callGraph(nullptr) { - memset(&prog,0,sizeof(prog)); } void Project::initialize() {