Skip to content

Commit be8e4e5

Browse files
committed
explorer: fixed crash on block info with multiple contract invocations
1 parent 7b59d82 commit be8e4e5

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

explorer/adapter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,8 @@ class Adapter : public Node::IObserver, public IAdapter {
14231423
else
14241424
{
14251425
NodeProcessor::ContractInvokeExtraInfo info;
1426+
info.m_NumNested = 0;
1427+
info.m_iParent = 0;
14261428
info.m_Cid = krn.m_Cid;
14271429
info.SetUnk(krn.m_iMethod, krn.m_Args, nullptr);
14281430
OnContract(krn, info);

node/processor.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5349,10 +5349,7 @@ bool NodeProcessor::BlockInterpretCtx::BvmProcessor::Invoke(const bvm2::Contract
53495349
}
53505350

53515351
if (m_Bic.m_pvC)
5352-
{
53535352
m_pFundsIO = &fundsIO;
5354-
m_iCurrentInvokeExtraInfo = (uint32_t) m_Bic.m_pvC->size();
5355-
}
53565353

53575354
CallFar(cid, iMethod, m_Stack.get_AlasSp(), (uint32_t)krn.m_Args.size(), 0);
53585355

@@ -6379,14 +6376,18 @@ void NodeProcessor::BlockInterpretCtx::BvmProcessor::CallFar(const bvm2::Contrac
63796376
{
63806377
auto& vec = *m_Bic.m_pvC; // alias
63816378

6382-
if (!vec.empty())
6379+
uint32_t iParent = 0;
6380+
assert(!m_FarCalls.m_Stack.empty());
6381+
if (m_FarCalls.m_Stack.size() > 1)
6382+
{
6383+
iParent = m_iCurrentInvokeExtraInfo;
63836384
CopyExtraInfoSigs();
6385+
}
63846386

63856387
ContractInvokeExtraInfo& x = vec.emplace_back();
6386-
6387-
x.m_iParent = m_iCurrentInvokeExtraInfo;
6388-
m_iCurrentInvokeExtraInfo = static_cast<uint32_t>(vec.size());
6388+
x.m_iParent = iParent;
63896389
x.m_NumNested = 0;
6390+
m_iCurrentInvokeExtraInfo = static_cast<uint32_t>(vec.size());
63906391

63916392
assert(m_pFundsIO);
63926393
m_pFundsIO->m_Map.swap(x.m_FundsIO.m_Map);

0 commit comments

Comments
 (0)