From 7dcde5b9f2f8c183d4cdad97fbf0ccf991888263 Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Tue, 7 Jun 2022 11:34:41 +0200 Subject: [PATCH] check for sentinel values directly --- symbolic-debuginfo/src/dwarf.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/symbolic-debuginfo/src/dwarf.rs b/symbolic-debuginfo/src/dwarf.rs index 8a859093c..8fd2358e0 100644 --- a/symbolic-debuginfo/src/dwarf.rs +++ b/symbolic-debuginfo/src/dwarf.rs @@ -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. @@ -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,