Skip to content

Commit

Permalink
Fix NULL dereference when parsing PE's resources
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarofe authored and romainthomas committed Jul 7, 2017
1 parent d2c376f commit cabc4ba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/PE/Binary.cpp
Expand Up @@ -318,7 +318,7 @@ bool Binary::has_exports(void) const {
}

bool Binary::has_resources(void) const {
return this->has_resources_;
return this->has_resources_ and this->resources_ != nullptr;
}

bool Binary::has_exceptions(void) const {
Expand Down Expand Up @@ -1097,10 +1097,16 @@ void Binary::rich_header(const RichHeader& rich_header) {
// ===============

ResourcesManager Binary::get_resources_manager(void) {
if (this->resources_ == nullptr or not this->has_resources()) {
throw not_found("There is no resources in the binary");
}
return ResourcesManager{this->resources_};
}

const ResourcesManager Binary::get_resources_manager(void) const {
if (this->resources_ == nullptr or not this->has_resources()) {
throw not_found("There is no resources in the binary");
}
return ResourcesManager{this->resources_};
}

Expand Down

0 comments on commit cabc4ba

Please sign in to comment.