4
0
mirror of https://github.com/QuasarApp/LIEF.git synced 2025-05-14 20:29:34 +00:00
This commit is contained in:
rthomas 2020-11-18 16:49:37 +01:00
parent acb108602d
commit f0ee03543b
2 changed files with 10 additions and 4 deletions

@ -226,10 +226,11 @@ uint64_t Binary::rva_to_offset(uint64_t RVA) {
});
if (it_section == std::end(sections_)) {
// If not found withint a section,
// If not found within a section,
// we assume that rva == offset
return static_cast<uint32_t>(RVA);
return RVA;
}
LIEF_TRACE("rva_to_offset(0x{:x}): {}", RVA, (*it_section)->name());
// rva - virtual_address + pointer_to_raw_data
uint32_t section_alignment = this->optional_header().section_alignment();

@ -704,8 +704,13 @@ void Parser::parse_exports(void) {
Export export_object = &export_directory_table;
uint32_t name_offset = this->binary_->rva_to_offset(export_directory_table.NameRVA);
export_object.name_ = this->stream_->peek_string_at(name_offset);
LIEF_DEBUG("Export name {}@0x{:x}", export_object.name_, name_offset);
if (export_directory_table.NameRVA == name_offset) {
LIEF_WARN("Export name offset seems corrupted (0x{:x} can't be converted to an offset",
export_directory_table.NameRVA);
} else {
export_object.name_ = this->stream_->peek_string_at(name_offset);
LIEF_DEBUG("Export name {}@0x{:x}", export_object.name_, name_offset);
}
// Parse Ordinal name table
uint32_t ordinal_table_offset = this->binary_->rva_to_offset(export_directory_table.OrdinalTableRVA);