diff options
| author | Kai Luo <gluokai@gmail.com> | 2023-01-09 23:02:53 +0800 |
|---|---|---|
| committer | Kai Luo <gluokai@gmail.com> | 2023-01-09 23:02:53 +0800 |
| commit | 04a697502fbb3a69fe5dbeb0b3babf6f1e67711f (patch) | |
| tree | 7013c8d66bbdd76cfd16564686593973bd0dd5e8 | |
| parent | 34534152f5ad64d4d1fbc50ef475bc68cb7ac750 (diff) | |
| download | rust-04a697502fbb3a69fe5dbeb0b3babf6f1e67711f.tar.gz rust-04a697502fbb3a69fe5dbeb0b3babf6f1e67711f.zip | |
Also check ttype_index when using SJLJ
| -rw-r--r-- | library/std/src/personality/dwarf/eh.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/library/std/src/personality/dwarf/eh.rs b/library/std/src/personality/dwarf/eh.rs index e7bd700b8b8..1e71da95a30 100644 --- a/library/std/src/personality/dwarf/eh.rs +++ b/library/std/src/personality/dwarf/eh.rs @@ -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)); + } } } } |
