36 int last_line_defined;
40 if (size_offset +
offset > data_size) {
68 if (string_buf_size == 0xFF) {
78 if (string_buf_size == 0 || size_offset == 0) {
82 len = string_buf_size - 1;
91 if (
dest && str_len) {
111 if (size_offset +
offset > data_size) {
115 total_size = code_size * 4 + size_offset;
117 if (total_size +
offset > data_size) {
142 if (
offset + 1 > data_size) {
155 switch (current_entry->
tag) {
160 if (
offset + data_len > data_size) {
163 delta_offset = data_len;
170 if (
offset + data_len > data_size) {
173 delta_offset = data_len;
204 current_entry->
data = recv_data;
210 return offset - base_offset;
226 delta_offset =
sizeof(
LUA_INT);
229 for (
i = 0;
i < consts_cnt; ++
i) {
237 return offset - base_offset;
246 current_entry->
offset = base_offset;
248 if (
offset + 2 > data_size) {
258 current_entry->
kind = 0;
265 return offset - base_offset;
277 delta_offset =
sizeof(
LUA_INT);
278 if (delta_offset +
offset > data_size) {
284 for (
i = 0;
i < upvalues_cnt; ++
i) {
292 return offset - base_offset;
310 for (
i = 0;
i < entries_cnt; ++
i) {
327 for (
i = 0;
i < entries_cnt; ++
i) {
360 for (
i = 0;
i < entries_cnt; ++
i) {
375 return offset - base_offset;
388 delta_offset =
sizeof(
LUA_INT);
389 if (
offset + delta_offset > data_size) {
396 for (
i = 0;
i < proto_cnt; ++
i) {
404 return offset - base_offset;
433 if (
offset + 3 > data_size) {
507 ut8 instruction_size;
548 (int_size !=
sizeof(
LUA_INT)) ||
549 (sizet_size !=
sizeof(
size_t))) {
550 RZ_LOG_ERROR(
"Size definition does not match with the expected size\n");
556 RZ_LOG_ERROR(
"Integer format does not match with the expected integer\n");
559 RZ_LOG_ERROR(
"Number format does not match with the expected number\n");
564 char *src_file_name =
NULL;
569 ret->
guid =
rz_str_new(src_file_name ? src_file_name :
"stripped");
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
LuaLineinfoEntry * lua_new_lineinfo_entry()
LuaConstEntry * lua_new_const_entry()
LuaProto * lua_new_proto_entry()
LuaDbgUpvalueEntry * lua_new_dbg_upvalue_entry()
LuaLocalVarEntry * lua_new_local_var_entry()
LuaUpvalueEntry * lua_new_upvalue_entry()
void lua_free_proto_entry(LuaProto *proto)
#define lua_check_error_offset(offset)
#define lua_check_error_offset_proto(offset, proto)
#define lua_return_if_null(proto)
#define LUAC_53_INSTRUCTION_SIZE_OFFSET
#define LUAC_53_INT_SIZE_OFFSET
#define LUAC_53_NUMBER_VALIDATION
#define LUAC_FILENAME_OFFSET
#define LUAC_53_NUMBER_VALID_OFFSET
#define LUAC_53_NUMBER_SIZE_OFFSET
#define LUAC_53_FORMAT_OFFSET
#define LUAC_53_INT_VALIDATION
#define LUAC_53_SIZET_SIZE_OFFSET
#define LUAC_53_INTEGER_VALID_OFFSET
#define LUAC_53_INTEGER_SIZE_OFFSET
static ut64 lua_parse_code(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
LuaProto * lua_parse_body_53(RzBuffer *buffer, ut64 base_offset, ut64 data_size)
static ut64 lua_parse_name(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
RzBinInfo * lua_parse_header_53(RzBinFile *bf, st32 major, st32 minor)
static ut64 lua_parse_const_entry(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
static ut64 lua_parse_debug(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
static ut64 lua_parse_upvalues(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
static ut64 lua_parse_string(RzBuffer *buffer, ut8 **dest, int *str_len, ut64 offset, ut64 data_size)
static double lua_load_number(RzBuffer *buffer, ut64 offset)
static ut64 lua_parse_line_defined(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
static void lua_load_block(RzBuffer *buffer, void *dest, size_t size, ut64 offset, ut64 data_size)
static ut64 lua_parse_consts(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
static ut64 lua_parse_protos(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
static ut64 lua_load_integer(RzBuffer *buffer, ut64 offset)
static ut32 lua_load_int(RzBuffer *buffer, ut64 offset)
static ut64 lua_parse_upvalue_entry(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
#define rz_return_val_if_fail(expr, val)
RZ_API bool rz_buf_read8_at(RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *result)
Read a byte at the specified address in the buffer.
RZ_API st64 rz_buf_read_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
Read len bytes of the buffer at the specified address.
#define rz_buf_read_le32_at(b, addr, result)
#define rz_buf_read_le64_at(b, addr, result)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_str_new(const char *str)
Store constant type, data, and offset of this constant in luac file.
ut64 offset
addr of this constant
void * data
can be Number/Integer/String
ut8 tag
type of this constant, see LUA_V* macros in luac_common.h
Store upvalue's debug info.
int name_len
length of name
ut8 * upvalue_name
upvalue name
Store line info attributes.
Store local var names and other info.
int varname_len
length of name
int end_pc
first deactive position
ut64 offset
offset of this entry
int start_pc
first active position
ut8 * varname
name of this variable
Store valuable info when parsing. Treat luac file body as a main function.
int name_size
size of proto name
ut64 lastline_defined
line number of function end
RzList * dbg_upvalue_entries
A list to store upvalue names.
ut64 line_defined
line number of function start
RzList * upvalue_entries
A list to store upvalue entries.
ut64 size
current proto size
ut8 is_vararg
is variable arg?
ut64 inner_proto_offset
sub proto section offset
ut64 code_skipped
opcode data offset to code_offset.
ut64 const_offset
const section offset
ut8 num_params
number of parameters of this proto
ut64 upvalue_size
upvalue section size
RzList * local_var_info_entries
A list to store local var entries.
RzList * const_entries
A list to store constant entries.
ut8 * proto_name
current proto name
ut64 code_offset
code section offset
RzList * proto_entries
A list to store sub proto entries.
ut64 upvalue_offset
upvalue section offset
ut64 offset
proto offset in bytes
ut64 debug_size
debug section size
ut64 debug_offset
debug section offset
RzList * line_info_entries
A list to store line info entries.
ut8 max_stack_size
max stack size
ut64 const_size
const section size
ut64 inner_proto_size
sub proto section size
ut64 code_size
code section size
Store upvalue attributes.
ut64 offset
offset of this upvalue
XX curplugin == o->plugin.
ut64(WINAPI *w32_GetEnabledXStateFeatures)()