36 if (
offset + 1 > data_size) {
51 RZ_LOG_ERROR(
"integer overflow while decoding integer size\n");
54 x = (
x << 7) | (
b & 0x7f);
55 }
while (((
b & 0x80) == 0) && (
i +
offset < data_size));
72 if (ret_buf_size == 0) {
77 string_len = ret_buf_size - 1;
82 ret[string_len] = 0x00;
87 if (
dest && str_len) {
89 *str_len = string_len;
94 total_offset = size_offset + string_len;
106 int last_line_defined;
114 size_offset += delta_offset;
130 total_size = code_size * 4 + size_offset;
132 if (total_size +
offset > data_size) {
157 if (
offset + 1 > data_size) {
169 switch (current_entry->
tag) {
175 if (
offset + data_len > data_size) {
178 delta_offset = data_len;
197 current_entry->
data = recv_data;
203 return offset - base_offset;
219 for (
i = 0;
i < consts_cnt; ++
i) {
227 return offset - base_offset;
236 current_entry->
offset = base_offset;
238 if (
offset + 3 > data_size) {
260 return offset - base_offset;
276 for (
i = 0;
i < upvalues_cnt; ++
i) {
284 return offset - base_offset;
299 for (
i = 0;
i < entries_cnt; ++
i) {
317 for (
i = 0;
i < entries_cnt; ++
i) {
337 for (
i = 0;
i < entries_cnt; ++
i) {
367 for (
i = 0;
i < entries_cnt; ++
i) {
382 return offset - base_offset;
399 for (
i = 0;
i < proto_cnt; ++
i) {
407 return offset - base_offset;
433 if (
offset + 3 > data_size) {
501 ut8 instruction_size;
544 RZ_LOG_ERROR(
"Size definition does not match with the expected size\n");
550 RZ_LOG_ERROR(
"Integer format does not match with the expected integer\n");
553 RZ_LOG_ERROR(
"Number format does not match with the expected number\n");
558 char *src_file_name =
NULL;
563 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)
LuaAbsLineinfoEntry * lua_new_abs_lineinfo_entry()
#define lua_check_error_offset(offset)
#define lua_check_error_offset_proto(offset, proto)
#define lua_return_if_null(proto)
#define LUAC_FILENAME_OFFSET
#define LUAC_54_INTEGER_SIZE_OFFSET
#define LUAC_54_NUMBER_SIZE_OFFSET
#define LUAC_54_INT_VALIDATION
#define LUAC_54_FORMAT_OFFSET
#define LUAC_54_NUMBER_VALIDATION
#define LUAC_54_INTEGER_VALID_OFFSET
#define LUAC_54_NUMBER_VALID_OFFSET
#define LUAC_54_INSTRUCTION_SIZE_OFFSET
static uint32_t const uint8_t uint32_t uint32_t limit
static ut64 lua_parse_code(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
RzBinInfo * lua_parse_header_54(RzBinFile *bf, st32 major, st32 minor)
static ut64 lua_parse_name(LuaProto *proto, RzBuffer *buffer, ut64 offset, ut64 data_size)
static ut64 lua_parse_szint(RzBuffer *buffer, int *size, ut64 offset, ut64 data_size)
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)
LuaProto * lua_parse_body_54(RzBuffer *buffer, ut64 base_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 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_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 line info attributes.
int line
line number in source file
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
RzList * abs_line_info_entries
A list to store absolutely line info entries.
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)()