Skip to content

Commit 04a6975

Browse files
committed
Also check ttype_index when using SJLJ
1 parent 3453415 commit 04a6975

File tree

1 file changed

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

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,21 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result
121121
let mut idx = ip;
122122
loop {
123123
let cs_lpad = reader.read_uleb128();
124-
let cs_action = reader.read_uleb128();
124+
let cs_action_entry = reader.read_uleb128();
125125
idx -= 1;
126126
if idx == 0 {
127127
// Can never have null landing pad for sjlj -- that would have
128128
// been indicated by a -1 call site index.
129129
let lpad = (cs_lpad + 1) as usize;
130-
return Ok(interpret_cs_action(cs_action, lpad));
130+
if cs_action_entry == 0 {
131+
return Ok(interpret_cs_action(0, lpad));
132+
} else {
133+
let action_record =
134+
(action_table as *mut u8).offset(cs_action_entry as isize - 1);
135+
let mut action_reader = DwarfReader::new(action_record);
136+
let ttype_index = action_reader.read_sleb128();
137+
return Ok(interpret_cs_action(ttype_index as u64, lpad));
138+
}
131139
}
132140
}
133141
}

0 commit comments

Comments
 (0)