Fix last covs

This commit is contained in:
pancake 2022-10-14 00:26:53 +02:00
parent b6d7e023cc
commit 52d1a7446a
7 changed files with 23 additions and 21 deletions

View File

@ -507,8 +507,8 @@ not_a_number:
return R_ANAL_ESIL_PARM_INVALID;
}
R_API int r_anal_esil_get_parm_size(RAnalEsil *esil, const char *str, ut64 *num, int *size) {
if (!str || !*str) {
static bool get_parm_size(RAnalEsil *esil, const char *str, ut64 *num, int *size) {
if (R_STR_ISEMPTY (str)) {
return false;
}
int parm_type = r_anal_esil_get_parm_type (esil, str);
@ -538,7 +538,7 @@ R_API int r_anal_esil_get_parm_size(RAnalEsil *esil, const char *str, ut64 *num,
}
R_API int r_anal_esil_get_parm(RAnalEsil *esil, const char *str, ut64 *num) {
return r_anal_esil_get_parm_size (esil, str, num, NULL);
return get_parm_size (esil, str, num, NULL);
}
R_API bool r_anal_esil_reg_write(RAnalEsil *esil, const char *dst, ut64 num) {
@ -1266,7 +1266,7 @@ static bool esil_asreq(RAnalEsil *esil) {
ut64 op_num, param_num;
char *op = r_anal_esil_pop (esil);
char *param = r_anal_esil_pop (esil);
if (op && r_anal_esil_get_parm_size (esil, op, &op_num, &regsize)) {
if (op && get_parm_size (esil, op, &op_num, &regsize)) {
if (param && r_anal_esil_get_parm (esil, param, &param_num)) {
ut64 mask = (regsize - 1);
param_num &= mask;
@ -1342,7 +1342,7 @@ static bool esil_asr(RAnalEsil *esil) {
ut64 op_num = 0, param_num = 0;
char *op = r_anal_esil_pop (esil);
char *param = r_anal_esil_pop (esil);
if (op && r_anal_esil_get_parm_size (esil, op, &op_num, &regsize)) {
if (op && get_parm_size (esil, op, &op_num, &regsize)) {
if (param && r_anal_esil_get_parm (esil, param, &param_num)) {
if (param_num > regsize - 1) {
// capstone bug?
@ -1389,7 +1389,7 @@ static bool esil_ror(RAnalEsil *esil) {
ut64 num, num2;
char *dst = r_anal_esil_pop (esil);
char *src = r_anal_esil_pop (esil);
if (dst && r_anal_esil_get_parm_size (esil, dst, &num, &regsize)) {
if (dst && get_parm_size (esil, dst, &num, &regsize)) {
if (src && r_anal_esil_get_parm (esil, src, &num2)) {
ut64 mask = (regsize - 1);
num2 &= mask;
@ -1411,7 +1411,7 @@ static bool esil_rol(RAnalEsil *esil) {
ut64 num, num2;
char *dst = r_anal_esil_pop (esil);
char *src = r_anal_esil_pop (esil);
if (dst && r_anal_esil_get_parm_size (esil, dst, &num, &regsize)) {
if (dst && get_parm_size (esil, dst, &num, &regsize)) {
if (src && r_anal_esil_get_parm (esil, src, &num2)) {
ut64 mask = (regsize - 1);
num2 &= mask;
@ -2084,7 +2084,7 @@ static bool esil_poke_some(RAnalEsil *esil) {
ut64 ptr, regs = 0, tmp;
char *count, *dst = r_anal_esil_pop (esil);
if (dst && r_anal_esil_get_parm_size (esil, dst, &tmp, &regsize)) {
if (dst && get_parm_size (esil, dst, &tmp, &regsize)) {
// reg
isregornum (esil, dst, &ptr);
count = r_anal_esil_pop (esil);
@ -2101,7 +2101,7 @@ static bool esil_poke_some(RAnalEsil *esil) {
free (count);
return true;
}
r_anal_esil_get_parm_size (esil, foo, &tmp, &regsize);
get_parm_size (esil, foo, &tmp, &regsize);
isregornum (esil, foo, &num64);
r_write_ble (b, num64, R_ARCH_CONFIG_IS_BIG_ENDIAN (esil->anal->config), regsize);
const int size_bytes = regsize / 8;

View File

@ -1,9 +1,6 @@
/* radare - LGPL - Copyright 2019-2022 - condret */
//#include <r_util.h>
#include <r_anal.h>
//#include <r_reg.h>
//#include <sdb.h>
typedef enum {
VAR_TYPE_REG = 0,

View File

@ -856,7 +856,6 @@ static inline char *pickle_json_mnemonic(int id) {
pj_s (pj, op_name_map[id].name);
} else if (id == -1) {
size_t i;
RStrBuf *buf = buf = r_strbuf_new ("");
for (i = 0; i < R_ARRAY_SIZE (op_name_map); i++) {
pj_s (pj, op_name_map[i].name);
}
@ -876,7 +875,7 @@ static char *pickle_mnemonics(RAnal *a, int id, bool json) {
}
if (id == -1) {
size_t i;
RStrBuf *buf = buf = r_strbuf_new ("");
RStrBuf *buf = r_strbuf_new ("");
for (i = 0; i < R_ARRAY_SIZE (op_name_map); i++) {
r_strbuf_append (buf, op_name_map[i].name);
r_strbuf_append (buf, "\n");

View File

@ -344,11 +344,15 @@ static int cmd_log(void *data, const char *input) {
if (n > 0 || *input == '0') {
r_core_log_list (core, n, n2, *input);
} else {
const char *arg = input + 1;
const char *arg = r_str_trim_head_ro (input + 1);
if (r_str_startswith (arg, "base64:")) {
ut8 *s = r_base64_decode_dyn (arg + 7, -1);
if (s) {
r_core_log_add (core, (const char *)s);
free (s);
} else {
R_LOG_ERROR ("Invalid base64 stream");
}
} else {
r_core_log_add (core, arg);
}

View File

@ -5382,6 +5382,7 @@ static bool cmd_pi(RCore *core, const char *input, int len, int l, ut8 *block) {
pj_kn (pj, "at", refi->at);
pj_end (pj);
r_anal_op_free (op);
free (dst);
} else {
char *s = r_core_cmd_strf (core, "pdi %i @ 0x%08"PFMT64x, 1, refi->at);
r_cons_printf ("%s", s);

View File

@ -2408,6 +2408,7 @@ static bool do_analstr_search(RCore *core, struct search_parameters *param, bool
char *res = r_strbuf_drain (rb);
r_cons_println (res);
free (res);
r_strbuf_free (sb);
return false;
}

View File

@ -9,7 +9,7 @@ NAME=pseudo-crash
FILE=-
CMDS=e asm.pseudo=1; e asm.arch=x86; e asm.bits=64; wx 7299; pdj 1
EXPECT=<<EOF
[{"offset":0,"esil":"cf,?{,18446744073709551515,rip,=,}","refptr":false,"fcn_addr":0,"fcn_last":0,"size":2,"opcode":"if (((unsigned) var) < 0) goto 0xffffffffffffff9b","disasm":"jb 0xffffffffffffff9b","bytes":"7299","family":"cpu","type":"cjmp","reloc":false,"type_num":2147483649,"type2_num":0,"jump":-101,"fail":2}]
[{"offset":0,"esil":"cf,?{,18446744073709551515,rip,=,}","refptr":0,"fcn_addr":0,"fcn_last":0,"size":2,"opcode":"if (((unsigned) var) < 0) goto 0xffffffffffffff9b","disasm":"jb 0xffffffffffffff9b","bytes":"7299","family":"cpu","type":"cjmp","reloc":false,"type_num":2147483649,"type2_num":0,"jump":-101,"fail":2}]
EOF
RUN