Go to the source code of this file.
|
RZ_API const ut8 * | rz_uleb128 (const ut8 *data, int datalen, RZ_NULLABLE ut64 *v, const char **error) |
|
RZ_API const ut8 * | rz_uleb128_decode (const ut8 *data, int *datalen, ut64 *v) |
|
RZ_API int | rz_uleb128_len (const ut8 *data, int size) |
|
RZ_API ut8 * | rz_uleb128_encode (const ut64 s, int *len) |
|
RZ_API const ut8 * | rz_leb128 (const ut8 *data, int datalen, st64 *v) |
|
RZ_API st64 | rz_sleb128 (const ut8 **data, const ut8 *end) |
|
RZ_API size_t | read_u32_leb128 (const ut8 *p, const ut8 *max, ut32 *out_val) |
|
RZ_API size_t | read_i32_leb128 (const ut8 *p, const ut8 *max, st32 *out_val) |
|
RZ_API size_t | read_u64_leb128 (const ut8 *p, const ut8 *max, ut64 *out_val) |
|
RZ_API size_t | read_i64_leb128 (const ut8 *p, const ut8 *max, st64 *out_val) |
|
◆ read_i32_leb128()
Definition at line 211 of file uleb128.c.
212 if (
p <
max && !(
p[0] & 0x80)) {
216 }
else if (
p + 1 <
max && !(
p[1] & 0x80)) {
220 }
else if (
p + 2 <
max && !(
p[2] & 0x80)) {
224 }
else if (
p + 3 <
max && !(
p[3] & 0x80)) {
228 }
else if (
p + 4 <
max && !(
p[4] & 0x80)) {
230 bool sign_bit_set = (
p[4] & 0x8);
231 int top_bits =
p[4] & 0xf0;
232 if ((sign_bit_set && top_bits != 0x70) || (!sign_bit_set && top_bits != 0)) {
#define SIGN_EXTEND(type, value, sign_bit)
References LEB128_1, LEB128_2, LEB128_3, LEB128_4, LEB128_5, max, p, and SIGN_EXTEND.
Referenced by consume_s7_r(), and wasm_dis().
◆ read_i64_leb128()
Definition at line 282 of file uleb128.c.
283 if (
p <
max && !(
p[0] & 0x80)) {
287 }
else if (
p + 1 <
max && !(
p[1] & 0x80)) {
291 }
else if (
p + 2 <
max && !(
p[2] & 0x80)) {
295 }
else if (
p + 3 <
max && !(
p[3] & 0x80)) {
299 }
else if (
p + 4 <
max && !(
p[4] & 0x80)) {
303 }
else if (
p + 5 <
max && !(
p[5] & 0x80)) {
307 }
else if (
p + 6 <
max && !(
p[6] & 0x80)) {
311 }
else if (
p + 7 <
max && !(
p[7] & 0x80)) {
315 }
else if (
p + 8 <
max && !(
p[8] & 0x80)) {
319 }
else if (
p + 9 <
max && !(
p[9] & 0x80)) {
321 bool sign_bit_set = (
p[9] & 0x1);
322 int top_bits =
p[9] & 0xfe;
323 if ((sign_bit_set && top_bits != 0x7e) || (!sign_bit_set && top_bits != 0)) {
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
References LEB128_1, LEB128_10, LEB128_2, LEB128_3, LEB128_4, LEB128_5, LEB128_6, LEB128_7, LEB128_8, LEB128_9, max, p, SIGN_EXTEND, and ut64().
Referenced by wasm_dis().
◆ read_u32_leb128()
Definition at line 186 of file uleb128.c.
187 if (
p <
max && !(
p[0] & 0x80)) {
190 }
else if (
p + 1 <
max && !(
p[1] & 0x80)) {
193 }
else if (
p + 2 <
max && !(
p[2] & 0x80)) {
196 }
else if (
p + 3 <
max && !(
p[3] & 0x80)) {
199 }
else if (
p + 4 <
max && !(
p[4] & 0x80)) {
References LEB128_1, LEB128_2, LEB128_3, LEB128_4, LEB128_5, max, and p.
Referenced by consume_u1_r(), consume_u32_r(), consume_u7_r(), decode_buffer(), get_cf_offset(), wasm_dis(), and wasm_op().
◆ read_u64_leb128()
Definition at line 244 of file uleb128.c.
245 if (
p <
max && !(
p[0] & 0x80)) {
248 }
else if (
p + 1 <
max && !(
p[1] & 0x80)) {
251 }
else if (
p + 2 <
max && !(
p[2] & 0x80)) {
254 }
else if (
p + 3 <
max && !(
p[3] & 0x80)) {
257 }
else if (
p + 4 <
max && !(
p[4] & 0x80)) {
260 }
else if (
p + 5 <
max && !(
p[5] & 0x80)) {
263 }
else if (
p + 6 <
max && !(
p[6] & 0x80)) {
266 }
else if (
p + 7 <
max && !(
p[7] & 0x80)) {
269 }
else if (
p + 8 <
max && !(
p[8] & 0x80)) {
272 }
else if (
p + 9 <
max && !(
p[9] & 0x80)) {
References LEB128_1, LEB128_10, LEB128_2, LEB128_3, LEB128_4, LEB128_5, LEB128_6, LEB128_7, LEB128_8, LEB128_9, max, p, and ut64().
Referenced by decode_buffer().
◆ rz_leb128()
◆ rz_sleb128()
◆ rz_uleb128()
Definition at line 9 of file uleb128.c.
13 bool malformed_uleb =
true;
24 data_end = data + datalen;
25 if (data && datalen > 0) {
27 for (
s = 0; data < data_end;
s += 7) {
31 *
error =
rz_str_newf(
"rz_uleb128: undefined behaviour in %d shift on ut32\n", (
int)
s);
35 sum |= ((
ut64)(
c & 0x7f) <<
s);
38 malformed_uleb =
false;
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
void error(const char *msg)
References c, error(), NULL, rz_str_newf(), s, ST32_MAX, ut64(), and v.
Referenced by parse_abbrev_raw(), parse_attr_value(), parse_comp_unit(), parse_dwarf_location(), parse_ext_opcode(), parse_line_header_source(), and parse_std_opcode().
◆ rz_uleb128_decode()
◆ rz_uleb128_encode()
◆ rz_uleb128_len()
Definition at line 57 of file uleb128.c.
60 while (
c > 0x7f &&
i <
size) {
References c, and i.