diff options
| author | Josh Ferrell <josh@vector35.com> | 2024-07-05 15:35:20 -0400 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2024-07-05 15:35:20 -0400 |
| commit | 006058bab73ded5adc94d4311d84c59f225b3f75 (patch) | |
| tree | d0f5d8b350d173a92b9ce61dae86a8655d16b9a1 /rust/examples | |
| parent | ebef0e0202e9d58907963d632549c2ca9bfa8ea5 (diff) | |
Prevent parsing non-block dwarf attributes as blocks
Diffstat (limited to 'rust/examples')
| -rw-r--r-- | rust/examples/dwarf/dwarf_import/src/helpers.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rust/examples/dwarf/dwarf_import/src/helpers.rs b/rust/examples/dwarf/dwarf_import/src/helpers.rs index 09465d82..92b08bce 100644 --- a/rust/examples/dwarf/dwarf_import/src/helpers.rs +++ b/rust/examples/dwarf/dwarf_import/src/helpers.rs @@ -264,12 +264,12 @@ pub(crate) fn get_attr_as_u64<R: Reader<Offset = usize>>(attr: &Attribute<R>) -> Some(value) } else if let Some(value) = attr.sdata_value() { Some(value as u64) - } else if let Some(mut expr) = attr.exprloc_value() { - match expr.0.len() { - 1 => expr.0.read_u8().map(u64::from).ok(), - 2 => expr.0.read_u16().map(u64::from).ok(), - 4 => expr.0.read_u32().map(u64::from).ok(), - 8 => expr.0.read_u64().ok(), + } else if let AttributeValue::Block(mut data) = attr.value() { + match data.len() { + 1 => data.read_u8().map(u64::from).ok(), + 2 => data.read_u16().map(u64::from).ok(), + 4 => data.read_u32().map(u64::from).ok(), + 8 => data.read_u64().ok(), _ => None } } else { |
