mirror of
https://github.com/QuasarApp/LIEF.git
synced 2025-05-11 11:09:32 +00:00
The last data directory might not be null
See: bc203f2b6a928f1457e9ca99456747bcb7adbbfff789d1c47e9479aac11598af
This commit is contained in:
parent
986a30e014
commit
9790ddfa82
@ -1110,11 +1110,6 @@ std::vector<uint8_t> Binary::authentihash(ALGORITHMS algo) const {
|
||||
.write(dir->size());
|
||||
}
|
||||
|
||||
// Empty data directory
|
||||
ios
|
||||
.write<uint32_t>(0)
|
||||
.write<uint32_t>(0);
|
||||
|
||||
for (const Section* sec : this->sections_) {
|
||||
std::array<char, 8> name = {0};
|
||||
const std::string& sec_name = sec->name();
|
||||
|
@ -150,12 +150,6 @@ void Builder::build(void) {
|
||||
*this << directory;
|
||||
}
|
||||
|
||||
DataDirectory last_one;
|
||||
last_one.RVA(0);
|
||||
last_one.size(0);
|
||||
|
||||
*this << last_one;
|
||||
|
||||
LIEF_DEBUG("[+] Sections");
|
||||
|
||||
for (const Section& section : this->binary_->sections()) {
|
||||
|
@ -108,7 +108,12 @@ void Parser::parse_data_directories(void) {
|
||||
}
|
||||
|
||||
this->binary_->data_directories_.reserve(nbof_datadir);
|
||||
for (size_t i = 0; i < nbof_datadir; ++i) {
|
||||
// WARNING: The PE specifications require that the data directory table ends with a null entry (RVA / Size,
|
||||
// set to 0).
|
||||
// Nevertheless it seems that this requirement is not enforced by the PE loader.
|
||||
// The binary bc203f2b6a928f1457e9ca99456747bcb7adbbfff789d1c47e9479aac11598af contains a non-null final
|
||||
// data directory (watermarking?)
|
||||
for (size_t i = 0; i < (nbof_datadir + 1); ++i) {
|
||||
std::unique_ptr<DataDirectory> directory{new DataDirectory{&data_directory[i], static_cast<DATA_DIRECTORY>(i)}};
|
||||
LIEF_DEBUG("Processing directory #{:d} ()", i, to_string(static_cast<DATA_DIRECTORY>(i)));
|
||||
LIEF_DEBUG(" - RVA: 0x{:04x}", data_directory[i].RelativeVirtualAddress);
|
||||
|
Loading…
x
Reference in New Issue
Block a user