Fix memory use after free error in vector

This commit is contained in:
drmortalwombat 2025-05-08 17:26:10 +02:00
parent d0411b7d52
commit 34ce9afeae
2 changed files with 9 additions and 2 deletions

View File

@ -161,6 +161,8 @@ void NativeRegisterDataSet::ResetCall(const NativeCodeInstruction& ins, int fast
else else
mRegs[i].Reset(); mRegs[i].Reset();
} }
else if (var->mAliased && ins.mLinkerObject->mProc->mStoresIndirect)
mRegs[i].Reset();
} }
else if (var->mAliased) else if (var->mAliased)
mRegs[i].Reset(); mRegs[i].Reset();
@ -54527,7 +54529,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
mInterProc->mLinkerObject->mNativeProc = this; mInterProc->mLinkerObject->mNativeProc = this;
CheckFunc = !strcmp(mIdent->mString, "growvoid"); CheckFunc = !strcmp(mIdent->mString, "main");
int nblocks = proc->mBlocks.Size(); int nblocks = proc->mBlocks.Size();
tblocks = new NativeCodeBasicBlock * [nblocks]; tblocks = new NativeCodeBasicBlock * [nblocks];

View File

@ -8454,7 +8454,12 @@ Expression* Parser::ParseNewOperator(void)
else if (pexp->mDecType->mType == DT_TYPE_REFERENCE && pexp->mDecType->mBase->IsConstSame(dec)) else if (pexp->mDecType->mType == DT_TYPE_REFERENCE && pexp->mDecType->mBase->IsConstSame(dec))
mdec = dec->mCopyConstructor; mdec = dec->mCopyConstructor;
else if (pexp->mDecType->mType == DT_TYPE_RVALUEREF && pexp->mDecType->mBase->IsSame(dec)) else if (pexp->mDecType->mType == DT_TYPE_RVALUEREF && pexp->mDecType->mBase->IsSame(dec))
mdec = dec->mMoveConstructor; {
if (dec->mMoveConstructor)
mdec = dec->mMoveConstructor;
else
mdec = dec->mCopyConstructor;
}
} }
} }
else else