diff options
| author | KyleMiles <krm504@nyu.edu> | 2023-08-22 09:45:42 -0400 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2023-08-22 09:45:42 -0400 |
| commit | f6879fc771f24778f67c84cc45b33e4921614206 (patch) | |
| tree | 3b4d82ad4d187cf292193d1bb04e383263852b26 /rust/examples | |
| parent | cae14dcc335f4d829d9f3989df1ac150341a191b (diff) | |
DWARF Import : Prevent another crash related to #4547
Diffstat (limited to 'rust/examples')
| -rw-r--r-- | rust/examples/dwarf/dwarf_import/src/helpers.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/rust/examples/dwarf/dwarf_import/src/helpers.rs b/rust/examples/dwarf/dwarf_import/src/helpers.rs index fa9d011d..5ea35017 100644 --- a/rust/examples/dwarf/dwarf_import/src/helpers.rs +++ b/rust/examples/dwarf/dwarf_import/src/helpers.rs @@ -179,11 +179,11 @@ pub(crate) fn get_attr_as_usize<R: Reader>(attr: Attribute<R>) -> Option<usize> // Parses DW_OP_address, DW_OP_const pub(crate) fn get_expr_value<R: Reader>(unit: &Unit<R>, attr: Attribute<R>) -> Option<u64> { if let AttributeValue::Exprloc(mut expression) = attr.value() { - match Operation::parse(&mut expression.0, unit.encoding()).unwrap() { - Operation::PlusConstant { value } => Some(value), - Operation::UnsignedConstant { value } => Some(value), - Operation::Address { address: 0 } => None, - Operation::Address { address } => Some(address), + match Operation::parse(&mut expression.0, unit.encoding()) { + Ok(Operation::PlusConstant { value }) => Some(value), + Ok(Operation::UnsignedConstant { value }) => Some(value), + Ok(Operation::Address { address: 0 }) => None, + Ok(Operation::Address { address }) => Some(address), _ => None, } } else { |
