diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d99fc8..52a1f070 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ * Fix bug that led to string data blocks potentially overlapping code blocks. * Fix bug that resulted in integral symbols on ISAs other than x64 (ARM and x86). * Fix symbolization bug of ADR instructions in ARM32 that refer to code. +* Fix bug in PE code inference that could lead to the whole .text section being + declared invalid if a data directory was attached to the end of the section. # 1.9.0 diff --git a/src/datalog/binary/pe/pe_binaries.dl b/src/datalog/binary/pe/pe_binaries.dl index 3119382f..52067e25 100644 --- a/src/datalog/binary/pe/pe_binaries.dl +++ b/src/datalog/binary/pe/pe_binaries.dl @@ -213,6 +213,7 @@ incremental_linking(First,Last):- !incremental_linking_candidate(First,Next), Count = count : { incremental_linking_candidate(First,_) }, Count > 5. + /** Locate data directory and debug data merged with the text section. Note that this is used to splice merged .rdata and .text sections. @@ -228,7 +229,8 @@ merged_data_region(DataStart,DataStart+DataSize):- ), loaded_section(SectionStart,SectionEnd,".text"), DataStart > SectionStart, - DataStart < SectionEnd. + // Do not consider data directories at the end of the code section. + DataStart + DataSize < SectionEnd. // Infer prepended .rdata boundaries. data_region(Start,Size):- diff --git a/src/gtirb-builder/PeReader.cpp b/src/gtirb-builder/PeReader.cpp index 9b63be9c..ac5f370e 100644 --- a/src/gtirb-builder/PeReader.cpp +++ b/src/gtirb-builder/PeReader.cpp @@ -164,7 +164,6 @@ void PeReader::addEntryBlock() Module->setEntryPoint(Block); } } - assert(Module->getEntryPoint() && "Failed to set module entry point."); } void PeReader::addAuxData()