Checks for type 'int' added to binary header

The structure 'AbsLineInfo' is hard-dumped into binary chunks, and
it comprises two 'int' fields.
This commit is contained in:
Roberto Ierusalimschy
2025-03-10 15:21:32 -03:00
parent cb88c1cd5d
commit b5b1995f29
4 changed files with 67 additions and 36 deletions

13
ldump.c
View File

@@ -253,16 +253,19 @@ static void dumpFunction (DumpState *D, const Proto *f) {
}
#define dumpNumInfo(D, tvar, value) \
{ tvar i = value; dumpByte(D, sizeof(tvar)); dumpVar(D, i); }
static void dumpHeader (DumpState *D) {
dumpLiteral(D, LUA_SIGNATURE);
dumpByte(D, LUAC_VERSION);
dumpByte(D, LUAC_FORMAT);
dumpLiteral(D, LUAC_DATA);
dumpByte(D, sizeof(Instruction));
dumpByte(D, sizeof(lua_Integer));
dumpByte(D, sizeof(lua_Number));
dumpInteger(D, LUAC_INT);
dumpNumber(D, LUAC_NUM);
dumpNumInfo(D, int, LUAC_INT);
dumpNumInfo(D, Instruction, LUAC_INST);
dumpNumInfo(D, lua_Integer, LUAC_INT);
dumpNumInfo(D, lua_Number, LUAC_NUM);
}