1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Merge pull request #1018 from EinBurgbauer/comptime-crash-fixes

Comptime crash fixes
This commit is contained in:
Brian Fiete 2021-05-23 07:07:00 -04:00 committed by GitHub
commit 369bb0640c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2953,10 +2953,11 @@ BfError* CeContext::Fail(const CeFrame& curFrame, const StringImpl& str)
}
if ((emitEntry != NULL) && (emitEntry->mFile != -1))
{
err += StrFormat(" at line% d:%d in %s", emitEntry->mLine + 1, emitEntry->mColumn + 1, ceFunction->mFiles[emitEntry->mFile].c_str());
auto moreInfo = passInstance->MoreInfo(err, mCeMachine->mCeModule->mCompiler->GetAutoComplete() != NULL);
if ((moreInfo != NULL) && (emitEntry != NULL))
if ((moreInfo != NULL))
{
BfErrorLocation* location = new BfErrorLocation();
location->mFile = ceFunction->mFiles[emitEntry->mFile];
@ -2965,6 +2966,7 @@ BfError* CeContext::Fail(const CeFrame& curFrame, const StringImpl& str)
moreInfo->mLocation = location;
}
}
}
return bfError;
}
@ -4626,6 +4628,12 @@ bool CeContext::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8*
return false;
}
if (paramIdx < 0 || paramIdx >= methodInstance->mParams.mSize)
{
_Fail("paramIdx is out of range");
return false;
}
addr_ce stringAddr = GetString(methodInstance->GetParamName(paramIdx));
_FixVariables();
*(int32*)(stackPtr + 0) = methodInstance->GetParamType(paramIdx)->mTypeId;