开发者

How to get an inner error message when executing Lua bytecode chunks?

开发者 https://www.devze.com 2023-03-16 03:24 出处:网络
I\'m trying to execute (and maybe later decompile) Lua bytecode to which I do not have the source code, the compiler or the parser. (I\'m guessing it uses some VM to execute?)

I'm trying to execute (and maybe later decompile) Lua bytecode to which I do not have the source code, the compiler or the parser. (I'm guessing it uses some VM to execute?)

It is a (slightly) altered version of Lua, with a custom header. After manually editing the header to make it possible to load and execute the bytecode with an official Lua executable, it gives me an error message: "Bad code in precom开发者_运维知识库piled chunk".

Now the problem is that it doesn't list a file offset, I do not know what exactly the problem is.

I'm guessing it's one or more of these:

  • Header still not right
  • Other opcodes
  • A second header
  • Some encryption

How do I know which one of these it is? How do I know where it starts being wrong? (where does the first error occur)

The file format is not documented publicly.

I've not worked with Lua bytecode before.

Edit: ChunkSpy IS able to decompile the bytecode.


The problem is that the bytecode does not pass the integrity check performed by the bytecode loader. This probably means that the bytecode was generated by hand, not by the Lua compiler. if you want to know exactly why the integrity check fails, you'll have to step-execute it in a C debugger. I assume that the bytecode listing generated by ChunkSpy makes sense.

0

精彩评论

暂无评论...
验证码 换一张
取 消