Skip to content

Commit 1de7588

Browse files
committed
WIP fix use-after-free
1 parent 2c1bdd4 commit 1de7588

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,25 +1338,25 @@ bool x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite(
13381338
if (unwind_plan.GetRowCount() < 2)
13391339
return false;
13401340

1341-
const UnwindPlan::Row *first_row = unwind_plan.GetRowAtIndex(0);
1342-
if (first_row->GetOffset() != 0)
1341+
UnwindPlan::Row first_row = *unwind_plan.GetRowAtIndex(0);
1342+
if (first_row.GetOffset() != 0)
13431343
return false;
1344-
uint32_t cfa_reg = first_row->GetCFAValue().GetRegisterNumber();
1344+
uint32_t cfa_reg = first_row.GetCFAValue().GetRegisterNumber();
13451345
if (unwind_plan.GetRegisterKind() != eRegisterKindLLDB) {
13461346
cfa_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(
13471347
unwind_plan.GetRegisterKind(),
1348-
first_row->GetCFAValue().GetRegisterNumber());
1348+
first_row.GetCFAValue().GetRegisterNumber());
13491349
}
13501350
if (cfa_reg != m_lldb_sp_regnum ||
1351-
first_row->GetCFAValue().GetOffset() != m_wordsize)
1351+
first_row.GetCFAValue().GetOffset() != m_wordsize)
13521352
return false;
13531353

1354-
const UnwindPlan::Row *original_last_row = unwind_plan.GetLastRow();
1354+
UnwindPlan::Row original_last_row = *unwind_plan.GetLastRow();
13551355

13561356
size_t offset = 0;
13571357
int row_id = 1;
13581358
bool unwind_plan_updated = false;
1359-
UnwindPlan::Row row = *first_row;
1359+
UnwindPlan::Row row = first_row;
13601360

13611361
// After a mid-function epilogue we will need to re-insert the original
13621362
// unwind rules so unwinds work for the remainder of the function. These
@@ -1380,7 +1380,7 @@ bool x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite(
13801380
continue;
13811381

13821382
if (reinstate_unwind_state) {
1383-
row = *original_last_row;
1383+
row = original_last_row;
13841384
row.SetOffset(offset);
13851385
unwind_plan.AppendRow(row);
13861386
reinstate_unwind_state = false;
@@ -1521,7 +1521,7 @@ bool x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite(
15211521
if (ret_pattern_p()) {
15221522
row.SetOffset(offset);
15231523
row.GetCFAValue().SetIsRegisterPlusOffset(
1524-
first_row->GetCFAValue().GetRegisterNumber(), m_wordsize);
1524+
first_row.GetCFAValue().GetRegisterNumber(), m_wordsize);
15251525

15261526
unwind_plan.InsertRow(row);
15271527
unwind_plan_updated = true;

0 commit comments

Comments
 (0)