lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> The crash could be reproduced on any Luac version.
> For example, to create such bytecode for little-endian Luac 5.3, it is enough to replace the "return" instruction with reserved opcode=63

Ok, the problem is the following line in PrintCode, which only works
if o < NUM_OPCODES :

printf("%-9s\t",luaP_opnames[o]);

Otherwise, we index beyond the size of luaP_opnames and all bets are
off. (I don't get a crash in macOS, but rather "__mode" is printed.)
GameGuardian should have updated the list of instructions and
NUM_OPCODES, and all would be well.

>> > The "format" byte in the header of a GameGuardian bytecode is zero.
>>
>> They should have changed that! It's there precisely to alert the loader!
>
> If GG script isn't using extended syntax (new bitwise operators)
> then the resulting GG bytecode is compatible with PUC Lua 5.2 bytecode.
> And any PUC Lua 5.2 bytecode is a correct GG bytecode too.
> (Assuming endianness and bitness are the same, of course.)
> Probably, in this case, using format=0 is OK?

That's one interpretation. But it also means that plain Lua will try
to load GG bytecode and then fail horribly at execution.