开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜