Skip to content

Commit

Permalink
check for sentinel values directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem committed Jun 7, 2022
1 parent d57c1ba commit 7dcde5b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions symbolic-debuginfo/src/dwarf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ pub enum DwarfErrorKind {
UnexpectedInline,

/// The debug_ranges of a function are invalid.
// TODO: remove this error, as the only place it was used was removed
InvertedFunctionRange,

/// The DWARF file is corrupted. See the cause for more information.
Expand Down Expand Up @@ -625,14 +624,16 @@ impl<'d, 'a> DwarfUnit<'d, 'a> {
return Ok(tuple);
}

if low_pc > high_pc {
// Similarly, u64::MAX/u64::MAX-1 may be used to indicate deleted code, which manifests
// itself as an inverted range here.
if low_pc == u64::MAX || low_pc == u64::MAX - 1 {
// Similarly, u64::MAX/u64::MAX-1 may be used to indicate deleted code.
// See https://reviews.llvm.org/D59553
// In this case, we will just ignore this DIE and its children, instead of failing the whole file.
return Ok(tuple);
}

if low_pc > high_pc {
return Err(DwarfErrorKind::InvertedFunctionRange.into());
}

range_buf.push(Range {
begin: low_pc,
end: high_pc,
Expand Down

0 comments on commit 7dcde5b

Please sign in to comment.