mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-08 00:52:54 +00:00
Don't access reference to a vector after pop_back
This is undefined behavior. Found by asan's detect_container_overflow.
This commit is contained in:
parent
1834ad4a69
commit
873b79b867
@ -156,7 +156,7 @@ void ThreadPlanStack::PushPlan(lldb::ThreadPlanSP new_plan_sp) {
|
||||
lldb::ThreadPlanSP ThreadPlanStack::PopPlan() {
|
||||
assert(m_plans.size() > 1 && "Can't pop the base thread plan");
|
||||
|
||||
lldb::ThreadPlanSP &plan_sp = m_plans.back();
|
||||
lldb::ThreadPlanSP plan_sp = std::move(m_plans.back());
|
||||
m_completed_plans.push_back(plan_sp);
|
||||
plan_sp->WillPop();
|
||||
m_plans.pop_back();
|
||||
@ -166,7 +166,7 @@ lldb::ThreadPlanSP ThreadPlanStack::PopPlan() {
|
||||
lldb::ThreadPlanSP ThreadPlanStack::DiscardPlan() {
|
||||
assert(m_plans.size() > 1 && "Can't discard the base thread plan");
|
||||
|
||||
lldb::ThreadPlanSP &plan_sp = m_plans.back();
|
||||
lldb::ThreadPlanSP plan_sp = std::move(m_plans.back());
|
||||
m_discarded_plans.push_back(plan_sp);
|
||||
plan_sp->WillPop();
|
||||
m_plans.pop_back();
|
||||
|
Loading…
Reference in New Issue
Block a user