Skip to content

Commit bbeca89

Browse files
std: assert we discard a uleb128 number
1 parent ef516aa commit bbeca89

File tree

1 file changed

+8
-2
lines changed
  • library/std/src/sys/personality/dwarf

1 file changed

+8
-2
lines changed

library/std/src/sys/personality/dwarf/eh.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,14 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result
8383
let call_site_encoding = unsafe {
8484
let ttype_encoding = reader.read::<u8>();
8585
if ttype_encoding != DW_EH_PE_omit {
86-
// Rust doesn't analyze exception types, so we don't care about the type table
87-
reader.read_uleb128();
86+
// discard the offset to the type table, we aren't interested
87+
if ttype_encoding & 0x0F != DW_EH_PE_uleb128 {
88+
rtabort!(
89+
"ttype encoding assumed to not vary based on architecture! found: {:02X}",
90+
ttype_encoding & 0xF
91+
);
92+
}
93+
let _ = reader.read_uleb128();
8894
}
8995

9096
reader.read::<u8>()

0 commit comments

Comments
 (0)