diff options
| author | Glenn Smith <glenn@vector35.com> | 2024-09-02 18:47:03 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2024-09-02 18:47:03 -0400 |
| commit | 3563597875113428290914767863801133383254 (patch) | |
| tree | 848a32fb2d1188f952f65103e3f6d7b3f50becf7 /rust/examples | |
| parent | 554709fc9c13d38195de9809dccff7af3ac2944b (diff) | |
Fix panic on dwarf import when an exception frame extends to the end of memory
Diffstat (limited to 'rust/examples')
| -rw-r--r-- | rust/examples/dwarf/dwarf_import/src/lib.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/rust/examples/dwarf/dwarf_import/src/lib.rs b/rust/examples/dwarf/dwarf_import/src/lib.rs index 98153398..74f2065e 100644 --- a/rust/examples/dwarf/dwarf_import/src/lib.rs +++ b/rust/examples/dwarf/dwarf_import/src/lib.rs @@ -322,11 +322,15 @@ fn parse_eh_frame<R: Reader>( return Ok(cie_data_offsets); } - // Store CIE offset for FDE range - cie_data_offsets.insert( - fde.initial_address()..fde.initial_address()+fde.len(), - fde.cie().data_alignment_factor() - ); + if fde.initial_address().overflowing_add(fde.len()).1 { + warn!("FDE at offset {:?} exceeds bounds of memory space! {:#x} + length {:#x}", fde.offset(), fde.initial_address(), fde.len()); + } else { + // Store CIE offset for FDE range + cie_data_offsets.insert( + fde.initial_address()..fde.initial_address() + fde.len(), + fde.cie().data_alignment_factor(), + ); + } } } } |
