Skip to content

Commit

Permalink
fix(cfi): Skip u64::MAX FDEs when converting DWARF (#868)
Browse files Browse the repository at this point in the history
We have seen FDEs with an initial address of u64::MAX in user-provided DWARF files. Such FDEs will invariably fail to process because of either an address overflow error in gimli or an underflow in the length calculation in line 756. Therefore, we skip them immediately so we don't abort the processing of the entire file.
  • Loading branch information
loewenheim authored Sep 17, 2024
1 parent 7cee3f4 commit 6e5bf06
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

**Fixes**
- symbolic-cfi: Skip invalid FDEs when converting DWARF to Breakpad CFI ([#868](https://github.com/getsentry/symbolic/pull/868))

**Internal**:

- Removed `dmsort` dependency and replaced uses with stable std sorts. ([#869](https://github.com/getsentry/symbolic/pull/869))
Expand Down
9 changes: 9 additions & 0 deletions symbolic-cfi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,15 @@ impl<W: Write> AsciiCfiWriter<W> {
R: Reader + Eq,
U: UnwindSection<R>,
{
// We have seen FDEs with an initial address of `u64::MAX` in user-provided
// DWARF files. Such FDEs will invariably fail to process because of either
// an address overflow error in `gimli` or an underflow in the `length`
// calculation below. Therefore, we skip them immediately so we don't abort
// the processing of the entire file.
if fde.initial_address() == u64::MAX {
return Ok(());
}

// Retrieves the register that specifies the return address. We need to assign a special
// format to this register for Breakpad.
let ra = fde.cie().return_address_register();
Expand Down

0 comments on commit 6e5bf06

Please sign in to comment.