Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug in the Lua 5.1 bytecode pattern #298

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions patterns/lua51.hexpat
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@ struct LuaBinaryHeader {
u8 lua_Number;
u8 is_lua_Number_integral;
};

LuaBinaryHeader header @ 0;

struct LuaString {
u64 size;
if (header.size_of_size_t == 4) {
u32 size;
} else {
u64 size;
}
if (size > 0) {
char data[size];
}
Expand Down Expand Up @@ -72,7 +79,7 @@ struct LocalVar {
struct LuaDebugInfo {
Vector<u32> lineInfo;
Vector<LocalVar> localVar;
Vector<u32> upvalues;
Vector<LuaString> upvalues;
};

struct LuaConstants{
Expand All @@ -96,9 +103,4 @@ struct LuaFunction {
LuaDebugInfo debugInfo;
};

struct LuaFile {
LuaBinaryHeader header;
LuaFunction func;
};

LuaFile file @ 0;
LuaFunction toplevelFunction @ 12; // Lua header size is always 12 bytes