Skip to content

Commit

Permalink
Merge branch 'fix-PE-merge-data-rule' into 'main'
Browse files Browse the repository at this point in the history
fix PE merge data section rule

See merge request rewriting/ddisasm!1222
  • Loading branch information
aeflores committed Oct 8, 2024
2 parents 4c7ed39 + ec829e1 commit 73e9f8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion src/datalog/binary/pe/pe_binaries.dl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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):-
Expand Down
1 change: 0 additions & 1 deletion src/gtirb-builder/PeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ void PeReader::addEntryBlock()
Module->setEntryPoint(Block);
}
}
assert(Module->getEntryPoint() && "Failed to set module entry point.");
}

void PeReader::addAuxData()
Expand Down

0 comments on commit 73e9f8a

Please sign in to comment.