Also check ttype_index when using SJLJ

This commit is contained in:
Kai Luo 2023-01-09 23:02:53 +08:00
parent 34534152f5
commit 04a697502f

View File

@ -121,13 +121,21 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result
let mut idx = ip;
loop {
let cs_lpad = reader.read_uleb128();
let cs_action = reader.read_uleb128();
let cs_action_entry = reader.read_uleb128();
idx -= 1;
if idx == 0 {
// Can never have null landing pad for sjlj -- that would have
// been indicated by a -1 call site index.
let lpad = (cs_lpad + 1) as usize;
return Ok(interpret_cs_action(cs_action, lpad));
if cs_action_entry == 0 {
return Ok(interpret_cs_action(0, lpad));
} else {
let action_record =
(action_table as *mut u8).offset(cs_action_entry as isize - 1);
let mut action_reader = DwarfReader::new(action_record);
let ttype_index = action_reader.read_sleb128();
return Ok(interpret_cs_action(ttype_index as u64, lpad));
}
}
}
}