Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | lua_proto_ex |
Store valuable info when parsing. Treat luac file body as a main function. More... | |
struct | lua_constant_entry |
Store constant type, data, and offset of this constant in luac file. More... | |
struct | lua_upvalue_entry |
Store upvalue attributes. More... | |
struct | lua_lineinfo_entry |
Store line info attributes. More... | |
struct | lua_abs_lineinfo_entry |
Store line info attributes. More... | |
struct | lua_local_var_entry |
Store local var names and other info. More... | |
struct | lua_dbg_upvalue_entry |
Store upvalue's debug info. More... | |
struct | luac_bin_info |
Macros | |
#define | LUAC_MAGIC_OFFSET 0x00 |
#define | LUAC_MAGIC_SIZE 4 |
#define | LUAC_VERSION_OFFSET 0x04 |
#define | LUAC_VERSION_SIZE 1 |
#define | LUAC_MAGIC "\x1b\x4c\x75\x61" |
#define | makevariant(t, v) ((t) | ((v) << 4)) |
#define | LUA_TNIL 0 |
#define | LUA_TBOOLEAN 1 |
#define | LUA_TNUMBER 3 |
#define | LUA_TSTRING 4 |
#define | LUA_VNIL makevariant(LUA_TNIL, 0) |
#define | LUA_VFALSE makevariant(LUA_TBOOLEAN, 0) |
#define | LUA_VTRUE makevariant(LUA_TBOOLEAN, 1) |
#define | LUA_VNUMINT makevariant(LUA_TNUMBER, 0) /* integer numbers */ |
#define | LUA_VNUMFLT makevariant(LUA_TNUMBER, 1) /* float numbers */ |
#define | LUA_VSHRSTR makevariant(LUA_TSTRING, 0) /* short strings */ |
#define | LUA_VLNGSTR makevariant(LUA_TSTRING, 1) /* long strings */ |
#define | lua_check_error_offset(offset) |
#define | lua_check_error_offset_proto(offset, proto) |
#define | lua_return_if_null(proto) |
Typedefs | |
typedef ut32 | LUA_INSTRUCTION |
typedef struct lua_proto_ex | LuaProtoHeavy |
typedef LuaProtoHeavy | LuaProto |
typedef struct lua_constant_entry | LuaConstEntry |
typedef struct lua_upvalue_entry | LuaUpvalueEntry |
typedef struct LuaProto | LuaProtoEntry |
typedef struct lua_lineinfo_entry | LuaLineinfoEntry |
typedef struct lua_abs_lineinfo_entry | LuaAbsLineinfoEntry |
typedef struct lua_local_var_entry | LuaLocalVarEntry |
typedef struct lua_dbg_upvalue_entry | LuaDbgUpvalueEntry |
typedef struct luac_bin_info | LuacBinInfo |
#define lua_check_error_offset | ( | offset | ) |
Definition at line 208 of file luac_common.h.
#define lua_check_error_offset_proto | ( | offset, | |
proto | |||
) |
Definition at line 212 of file luac_common.h.
#define lua_return_if_null | ( | proto | ) |
Definition at line 217 of file luac_common.h.
#define LUA_TBOOLEAN 1 |
Definition at line 27 of file luac_common.h.
#define LUA_TNIL 0 |
Definition at line 26 of file luac_common.h.
#define LUA_TNUMBER 3 |
Definition at line 28 of file luac_common.h.
#define LUA_TSTRING 4 |
Definition at line 29 of file luac_common.h.
#define LUA_VFALSE makevariant(LUA_TBOOLEAN, 0) |
Definition at line 32 of file luac_common.h.
#define LUA_VLNGSTR makevariant(LUA_TSTRING, 1) /* long strings */ |
Definition at line 37 of file luac_common.h.
#define LUA_VNIL makevariant(LUA_TNIL, 0) |
Definition at line 31 of file luac_common.h.
#define LUA_VNUMFLT makevariant(LUA_TNUMBER, 1) /* float numbers */ |
Definition at line 35 of file luac_common.h.
#define LUA_VNUMINT makevariant(LUA_TNUMBER, 0) /* integer numbers */ |
Definition at line 34 of file luac_common.h.
#define LUA_VSHRSTR makevariant(LUA_TSTRING, 0) /* short strings */ |
Definition at line 36 of file luac_common.h.
#define LUA_VTRUE makevariant(LUA_TBOOLEAN, 1) |
Definition at line 33 of file luac_common.h.
#define LUAC_MAGIC "\x1b\x4c\x75\x61" |
Definition at line 21 of file luac_common.h.
#define LUAC_MAGIC_OFFSET 0x00 |
Definition at line 16 of file luac_common.h.
#define LUAC_MAGIC_SIZE 4 |
Definition at line 17 of file luac_common.h.
#define LUAC_VERSION_OFFSET 0x04 |
Definition at line 18 of file luac_common.h.
#define LUAC_VERSION_SIZE 1 |
Definition at line 19 of file luac_common.h.
Definition at line 24 of file luac_common.h.
typedef ut32 LUA_INSTRUCTION |
Definition at line 13 of file luac_common.h.
typedef struct lua_abs_lineinfo_entry LuaAbsLineinfoEntry |
typedef struct luac_bin_info LuacBinInfo |
typedef struct lua_constant_entry LuaConstEntry |
typedef struct lua_dbg_upvalue_entry LuaDbgUpvalueEntry |
typedef struct lua_lineinfo_entry LuaLineinfoEntry |
typedef struct lua_local_var_entry LuaLocalVarEntry |
typedef LuaProtoHeavy LuaProto |
Definition at line 87 of file luac_common.h.
typedef struct LuaProto LuaProtoEntry |
Definition at line 87 of file luac_common.h.
typedef struct lua_proto_ex LuaProtoHeavy |
typedef struct lua_upvalue_entry LuaUpvalueEntry |
void _luac_build_info | ( | LuaProto * | proto, |
LuacBinInfo * | info | ||
) |
Definition at line 225 of file luac_bin.c.
References lua_proto_ex::code_offset, lua_proto_ex::code_size, lua_proto_ex::const_entries, lua_proto_ex::const_offset, lua_proto_ex::const_size, lua_constant_entry::data, lua_constant_entry::data_len, lua_proto_ex::dbg_upvalue_entries, lua_proto_ex::debug_offset, lua_proto_ex::debug_size, get_constant_symbol_name(), get_tag_string(), get_upvalue_symbol_name(), i, info(), lua_proto_ex::inner_proto_offset, lua_proto_ex::inner_proto_size, lua_proto_ex::local_var_info_entries, LUA_VLNGSTR, LUA_VSHRSTR, luac_add_section(), luac_add_string(), luac_add_symbol(), lua_dbg_upvalue_entry::name_len, lua_proto_ex::name_size, NULL, lua_proto_ex::offset, lua_constant_entry::offset, lua_upvalue_entry::offset, lua_local_var_entry::offset, lua_dbg_upvalue_entry::offset, lua_proto_ex::proto_entries, lua_proto_ex::proto_name, RZ_FREE, rz_list_length(), RZ_NEWS0, rz_str_new(), rz_str_newf(), lua_proto_ex::size, lua_constant_entry::tag, lua_proto_ex::upvalue_entries, lua_dbg_upvalue_entry::upvalue_name, lua_proto_ex::upvalue_offset, lua_proto_ex::upvalue_size, ut64(), lua_local_var_entry::varname, and lua_local_var_entry::varname_len.
Referenced by luac_build_info().
void lua_free_const_entry | ( | LuaConstEntry * | entry | ) |
Definition at line 111 of file luac_common.c.
References free().
Referenced by lua_new_proto_entry().
void lua_free_dbg_upvalue_entry | ( | LuaDbgUpvalueEntry * | entry | ) |
Definition at line 94 of file luac_common.c.
References free().
Referenced by lua_new_proto_entry().
void lua_free_local_var_entry | ( | LuaLocalVarEntry * | entry | ) |
Definition at line 103 of file luac_common.c.
References free().
Referenced by lua_new_proto_entry().
void lua_free_proto_entry | ( | LuaProto * | proto | ) |
Definition at line 119 of file luac_common.c.
References lua_proto_ex::abs_line_info_entries, lua_proto_ex::const_entries, lua_proto_ex::dbg_upvalue_entries, free(), lua_proto_ex::line_info_entries, lua_proto_ex::local_var_info_entries, lua_proto_ex::proto_entries, lua_proto_ex::proto_name, rz_list_free(), and lua_proto_ex::upvalue_entries.
Referenced by load_buffer(), lua_new_proto_entry(), lua_parse_body_53(), and lua_parse_body_54().
LuaAbsLineinfoEntry* lua_new_abs_lineinfo_entry | ( | ) |
LuaConstEntry* lua_new_const_entry | ( | ) |
Definition at line 33 of file luac_common.c.
References RZ_NEW0.
Referenced by lua_parse_const_entry().
LuaDbgUpvalueEntry* lua_new_dbg_upvalue_entry | ( | ) |
LuaLineinfoEntry* lua_new_lineinfo_entry | ( | ) |
LuaLocalVarEntry* lua_new_local_var_entry | ( | ) |
LuaProto* lua_new_proto_entry | ( | ) |
Definition at line 38 of file luac_common.c.
References lua_proto_ex::abs_line_info_entries, lua_proto_ex::const_entries, lua_proto_ex::dbg_upvalue_entries, fail, free(), lua_proto_ex::line_info_entries, lua_proto_ex::local_var_info_entries, lua_free_const_entry(), lua_free_dbg_upvalue_entry(), lua_free_local_var_entry(), lua_free_proto_entry(), NULL, lua_proto_ex::proto_entries, rz_list_newf(), RZ_LOG_ERROR, RZ_NEW0, and lua_proto_ex::upvalue_entries.
Referenced by lua_parse_body_53(), and lua_parse_body_54().
LuaUpvalueEntry* lua_new_upvalue_entry | ( | ) |
Definition at line 28 of file luac_common.c.
References RZ_NEW0.
Referenced by lua_parse_upvalue_entry().
Definition at line 407 of file parse_53.c.
References lua_proto_ex::code_offset, lua_proto_ex::const_offset, lua_proto_ex::debug_offset, lua_proto_ex::inner_proto_offset, lua_proto_ex::inner_proto_size, lua_proto_ex::is_vararg, lua_check_error_offset_proto, lua_free_proto_entry(), lua_new_proto_entry(), lua_parse_code(), lua_parse_consts(), lua_parse_debug(), lua_parse_line_defined(), lua_parse_name(), lua_parse_protos(), lua_parse_upvalues(), lua_proto_ex::max_stack_size, NULL, lua_proto_ex::num_params, lua_proto_ex::offset, rz_buf_read8_at(), lua_proto_ex::size, lua_proto_ex::upvalue_offset, and ut64().
Referenced by load_buffer(), and lua_parse_protos().
Definition at line 410 of file parse_54.c.
References lua_proto_ex::code_offset, lua_proto_ex::const_offset, lua_proto_ex::debug_offset, lua_proto_ex::inner_proto_offset, lua_proto_ex::inner_proto_size, lua_proto_ex::is_vararg, lua_check_error_offset_proto, lua_free_proto_entry(), lua_new_proto_entry(), lua_parse_code(), lua_parse_consts(), lua_parse_debug(), lua_parse_line_defined(), lua_parse_name(), lua_parse_protos(), lua_parse_upvalues(), lua_proto_ex::max_stack_size, NULL, lua_proto_ex::num_params, lua_proto_ex::offset, rz_buf_read8_at(), rz_return_val_if_fail, lua_proto_ex::size, lua_proto_ex::upvalue_offset, and ut64().
Referenced by load_buffer(), and lua_parse_protos().
Definition at line 483 of file parse_53.c.
References rz_bin_info_t::arch, rz_bin_info_t::bclass, rz_bin_info_t::bits, rz_bin_file_t::buf, rz_bin_info_t::compiler, rz_bin_info_t::cpu, rz_bin_info_t::file, rz_bin_file_t::file, free(), rz_bin_info_t::guid, lua_load_integer(), lua_load_number(), lua_parse_string(), LUAC_53_FORMAT_OFFSET, LUAC_53_HDRSIZE, LUAC_53_INSTRUCTION_SIZE_OFFSET, LUAC_53_INT_SIZE_OFFSET, LUAC_53_INT_VALIDATION, LUAC_53_INTEGER_SIZE_OFFSET, LUAC_53_INTEGER_VALID_OFFSET, LUAC_53_NUMBER_SIZE_OFFSET, LUAC_53_NUMBER_VALID_OFFSET, LUAC_53_NUMBER_VALIDATION, LUAC_53_SIZET_SIZE_OFFSET, LUAC_54_FORMAT, LUAC_FILENAME_OFFSET, rz_bin_info_t::machine, major, minor, NULL, rz_bin_info_t::os, rz_bin_info_t::rclass, rz_buf_read8_at(), RZ_LOG_ERROR, RZ_NEW0, rz_str_new(), rz_str_newf(), rz_bin_file_t::size, st64, rz_bin_info_t::type, and ut64().
Referenced by load_buffer().
Definition at line 484 of file parse_54.c.
References rz_bin_info_t::arch, rz_bin_info_t::bclass, rz_bin_info_t::bits, rz_bin_file_t::buf, rz_bin_info_t::compiler, rz_bin_info_t::cpu, rz_bin_info_t::file, rz_bin_file_t::file, free(), rz_bin_info_t::guid, lua_load_integer(), lua_load_number(), lua_parse_string(), LUAC_54_FORMAT, LUAC_54_FORMAT_OFFSET, LUAC_54_HDRSIZE, LUAC_54_INSTRUCTION_SIZE_OFFSET, LUAC_54_INT_VALIDATION, LUAC_54_INTEGER_SIZE_OFFSET, LUAC_54_INTEGER_VALID_OFFSET, LUAC_54_NUMBER_SIZE_OFFSET, LUAC_54_NUMBER_VALID_OFFSET, LUAC_54_NUMBER_VALIDATION, LUAC_FILENAME_OFFSET, rz_bin_info_t::machine, major, minor, NULL, rz_bin_info_t::os, rz_bin_info_t::rclass, rz_buf_read8_at(), RZ_LOG_ERROR, RZ_NEW0, rz_str_new(), rz_str_newf(), rz_bin_file_t::size, st64, rz_bin_info_t::type, and ut64().
Referenced by load_buffer().
Definition at line 44 of file luac_bin.c.
References rz_list_append(), and RZ_NEW0.
Referenced by luac_build_info().
Definition at line 6 of file luac_bin.c.
References rz_bin_section_t::arch, rz_bin_section_t::bits, rz_bin_section_t::has_strings, rz_bin_section_t::is_data, rz_bin_section_t::name, rz_bin_section_t::paddr, rz_bin_section_t::perm, rz_list_append(), RZ_NEW0, RZ_PERM_R, RZ_PERM_X, rz_str_new(), rz_bin_section_t::size, rz_bin_section_t::vaddr, and rz_bin_section_t::vsize.
Referenced by _luac_build_info().
Definition at line 57 of file luac_bin.c.
References rz_bin_string_t::length, rz_bin_string_t::paddr, rz_list_append(), RZ_NEW0, rz_str_new(), RZ_STRING_ENC_UTF8, rz_bin_string_t::size, rz_bin_string_t::string, rz_bin_string_t::type, and rz_bin_string_t::vaddr.
Referenced by _luac_build_info().
void luac_add_symbol | ( | RzList * | symbol_list, |
char * | name, | ||
ut64 | offset, | ||
ut64 | size, | ||
const char * | type | ||
) |
Definition at line 30 of file luac_bin.c.
References rz_bin_symbol_t::name, rz_bin_symbol_t::paddr, rz_list_append(), RZ_NEW0, rz_str_new(), rz_bin_symbol_t::size, type, rz_bin_symbol_t::type, and rz_bin_symbol_t::vaddr.
Referenced by _luac_build_info().
LuacBinInfo* luac_build_info | ( | LuaProto * | proto | ) |
Definition at line 114 of file luac_bin.c.
References _luac_build_info(), lua_proto_ex::code_offset, lua_proto_ex::code_skipped, luac_bin_info::entry_list, free_rz_addr(), free_rz_section(), free_rz_string(), luac_add_entry(), NULL, RZ_BIN_ENTRY_TYPE_PROGRAM, rz_bin_symbol_free(), rz_list_newf(), RZ_LOG_ERROR, RZ_NEW0, luac_bin_info::section_list, luac_bin_info::string_list, luac_bin_info::symbol_list, try_free_empty_list(), and ut64().
Referenced by load_buffer().