Skip to content

Commit

Permalink
fix bug in pe parser
Browse files Browse the repository at this point in the history
  • Loading branch information
0vercl0k committed Feb 14, 2022
1 parent 5b6f643 commit cccc7e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/rp/pe.hpp
Expand Up @@ -44,9 +44,10 @@ class PE : public ExecutableFormat {
get_executables_section(std::ifstream &file,
const uint64_t base) const override {
std::vector<Section> exec_sections;

const uint32_t Executable =
RP_IMAGE_SCN_MEM_EXECUTE | RP_IMAGE_SCN_CNT_CODE;
for (const auto &sectionheader : m_pPELayout->imgSectionHeaders) {
if (!(sectionheader.Characteristics & RP_IMAGE_SCN_MEM_EXECUTE)) {
if (!(sectionheader.Characteristics & Executable)) {
continue;
}

Expand Down
3 changes: 2 additions & 1 deletion src/rp/pe_struct.hpp
Expand Up @@ -270,7 +270,8 @@ using RP_IMAGE_OPTIONAL_HEADER64 = RP_IMAGE_OPTIONAL_HEADER<x64Version>;
// Section header format.
//

const uint32_t RP_IMAGE_SCN_MEM_EXECUTE = 0x00000020;
const uint32_t RP_IMAGE_SCN_CNT_CODE = 0x00000020;
const uint32_t RP_IMAGE_SCN_MEM_EXECUTE = 0x20000000;
const uint32_t RP_IMAGE_SIZEOF_SHORT_NAME = 8;

struct RP_IMAGE_SECTION_HEADER {
Expand Down

0 comments on commit cccc7e0

Please sign in to comment.