1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fix uninitialized data in packing holes in BfVariant structs

This commit is contained in:
Brian Fiete 2024-10-21 16:41:54 -04:00
parent 979818388e
commit f06e5efd2f

View file

@ -12945,7 +12945,9 @@ BfVariant BfModule::TypedValueToVariant(BfAstNode* refNode, const BfTypedValue&
}
else
{
BfVariant::StructData* structData = (BfVariant::StructData*)(new uint8[value.mType->mSize + 4]);
int allocSize = value.mType->mSize + 4;
BfVariant::StructData* structData = (BfVariant::StructData*)(new uint8[allocSize]);
memset(structData, 0, allocSize);
structData->mSize = value.mType->mSize;
mBfIRBuilder->WriteConstant(value.mValue, structData->mData, value.mType);
variant.mTypeCode = BfTypeCode_Struct;