Check bytecode version before writing type information

This commit is contained in:
GRH 2024-05-08 22:43:41 +03:00 committed by GitHub
parent 8a64cb8b73
commit 39ab275f5f
Signed by: DevComp
GPG key ID: B5690EEEBB952194

View file

@ -665,8 +665,11 @@ void BytecodeBuilder::finalize()
bytecode = char(version);
if (version >= 4)
{
uint8_t typesversion = getTypeEncodingVersion();
writeByte(bytecode, typesversion);
}
writeStringTable(bytecode);
@ -690,6 +693,8 @@ void BytecodeBuilder::writeFunction(std::string& ss, uint32_t id, uint8_t flags)
writeByte(ss, func.numupvalues);
writeByte(ss, func.isvararg);
if (getVersion() >= 4)
{
writeByte(ss, flags);
if (FFlag::LuauCompileTypeInfo)
@ -729,6 +734,7 @@ void BytecodeBuilder::writeFunction(std::string& ss, uint32_t id, uint8_t flags)
writeVarInt(ss, uint32_t(func.typeinfo.size()));
ss.append(func.typeinfo);
}
}
// instructions
writeVarInt(ss, uint32_t(insns.size()));