Skip to content

Commit

Permalink
Fix DWARF import crash when FDE has row with start==end
Browse files Browse the repository at this point in the history
  • Loading branch information
negasora committed Oct 14, 2024
1 parent a10ba14 commit 7d0b6bc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions rust/examples/dwarf/dwarf_import/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,15 @@ where <U as UnwindSection<R>>::Offset: std::hash::Hash {
match row.cfa() {
CfaRule::RegisterAndOffset {register: _, offset} => {
// TODO: we should store offsets by register
cfa_offsets.insert(
row.start_address()..row.end_address(),
*offset,
);
if row.start_address() < row.end_address() {
cfa_offsets.insert(
row.start_address()..row.end_address(),
*offset,
);
}
else {
debug!("Invalid FDE table row addresses: {:#x}..{:#x}", row.start_address(), row.end_address());
}
},
CfaRule::Expression(_) => {
debug!("Unhandled CFA expression when determining offset");
Expand Down

0 comments on commit 7d0b6bc

Please sign in to comment.