mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-12 21:34:11 +02:00
Fixed attempted array allocation with negative dimension
This commit is contained in:
parent
a5fff0fdbc
commit
6b9bb361f9
1 changed files with 5 additions and 0 deletions
|
@ -13772,6 +13772,11 @@ void BfExprEvaluator::CreateObject(BfObjectCreateExpression* objCreateExpr, BfAs
|
||||||
if ((constant != NULL) && (mModule->mBfIRBuilder->IsInt(constant->mTypeCode)))
|
if ((constant != NULL) && (mModule->mBfIRBuilder->IsInt(constant->mTypeCode)))
|
||||||
{
|
{
|
||||||
int64 dimLength = constant->mInt64;
|
int64 dimLength = constant->mInt64;
|
||||||
|
if (dimLength < 0)
|
||||||
|
{
|
||||||
|
mModule->Fail(StrFormat("Invalid array dimension '%lld'", dimLength), dimLengthRefs[dim]);
|
||||||
|
dimLength = -1;
|
||||||
|
}
|
||||||
dimLengths.push_back(dimLength);
|
dimLengths.push_back(dimLength);
|
||||||
}
|
}
|
||||||
else if ((constant != NULL) && (constant->mConstType == BfConstType_Undef))
|
else if ((constant != NULL) && (constant->mConstType == BfConstType_Undef))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue