Fix last covs

This commit is contained in:
pancake 2022-04-25 23:00:37 +02:00
parent 59f9681da4
commit cfd66d0d28
9 changed files with 22 additions and 21 deletions

View File

@ -208,7 +208,7 @@ static int java_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len
return sz;
}
IFDBG {
R_LOG_DEBUG ("Extracting op from buffer (%d byte(s)) @ 0x%04x\n", len, addr);
R_LOG_DEBUG ("Extracting op from buffer (%d byte(s)) @ 0x%04x\n", (int)len, (ut32)addr);
R_LOG_DEBUG ("Parsing op: (0x%02x) %s.\n", op_byte, JAVA_OPS[op_byte].name);
}
op->addr = addr;

View File

@ -888,10 +888,13 @@ static bool mnem_jbc(char const*const*arg, ut16 pc, ut8**out) {
}
ut16 jmp_addr;
to_address (arg[1], &jmp_addr);
if (!to_address (arg[1], &jmp_addr)) {
R_LOG_DEBUG ("error during the assembly: address %x not found", jmp_addr);
return false;
}
if (!relative_address (pc + 1, jmp_addr, (*out) + 2)) {
eprintf ("error during the assembly: address %x not found\n", jmp_addr);
R_LOG_DEBUG ("error during the assembly: address %x not found", jmp_addr);
return false;
}

View File

@ -14,7 +14,7 @@ static char *mnemonics(RAsm *a, int id, bool json) {
pj = pj_new ();
pj_a (pj);
} else {
r_strbuf_new ("");
buf = r_strbuf_new ("");
}
for (i = 1; ; i++) {
const char *op = cs_insn_name (cd, i);

View File

@ -362,10 +362,6 @@ RCoreSymCacheElement *r_coresym_cache_element_new(RBinFile *bf, RBuffer *buf, ut
continue;
}
string_origin = relative_to_strings? b + start_of_strings : cursor;
if (!string_origin) {
cursor += R_CS_EL_SIZE_LSYM;
continue;
}
lsym->flc.file = str_dup_safe (b, string_origin + file_name_off, end);
if (!lsym->flc.file) {
cursor += R_CS_EL_SIZE_LSYM;

View File

@ -1654,6 +1654,7 @@ static int cmd_ww(void *data, const char *input) {
char *str = ostr;
int len = r_str_unescape (str);
if (len < 1) {
free (ostr);
return 0;
}
len++;
@ -1663,10 +1664,11 @@ static int cmd_ww(void *data, const char *input) {
if (tmp) {
int i;
for (i = 0; i < len; i++) {
if (i % 2)
if (i % 2) {
tmp[i] = 0;
else
} else {
tmp[i] = str[i >> 1];
}
}
str = tmp;
if (core->io->desc) {
@ -1784,7 +1786,7 @@ static int cmd_wa(void *data, const char *input) {
ut64 at = core->offset;
repeat:
if (!r_anal_op (core->anal, &analop, at, core->block + delta, core->blocksize - delta, R_ANAL_OP_MASK_BASIC)) {
eprintf ("Invalid instruction?\n");
R_LOG_DEBUG ("Invalid instruction?");
break;
}
if (delta < acode->len) {
@ -1800,11 +1802,13 @@ repeat:
} else if (input[0] == 'i') { // "wai"
RAnalOp analop;
if (!r_anal_op (core->anal, &analop, core->offset, core->block, core->blocksize, R_ANAL_OP_MASK_BASIC)) {
eprintf ("Invalid instruction?\n");
R_LOG_DEBUG ("Invalid instruction?");
r_anal_op_fini (&analop);
r_asm_code_free (acode);
break;
}
if (analop.size < acode->len) {
eprintf ("Doesnt fit\n");
R_LOG_DEBUG ("Doesnt fit");
r_anal_op_fini (&analop);
r_asm_code_free (acode);
break;

View File

@ -110,7 +110,7 @@ static void rtr_textlog_chat(RCore *core, TextLog T) {
char buf[1024];
int lastmsg = 0;
const char *me = r_config_get (core->config, "cfg.user");
char *ret, msg[1024];
char *ret, msg[1024] = {0};
eprintf ("Type '/help' for commands and ^D to quit:\n");
char *oldprompt = strdup (r_line_singleton ()->prompt);

View File

@ -1361,7 +1361,7 @@ RList *linux_desc_list(int pid) {
type = '-';
}
}
// Read permissions
// Read permissions // TOCTOU
if (lstat (fn, &st) != -1) {
if (st.st_mode & S_IRUSR) {
perm |= R_PERM_R;
@ -1385,10 +1385,10 @@ RList *linux_desc_list(int pid) {
free (fn);
return NULL;
}
free (fn);
fdinfo[sizeof (fdinfo) - 1] = '\0';
close (f);
}
free (fn);
/* First line of fdinfo is "pos: [offset]" */
ut64 offset = (int) r_num_math (NULL, r_str_trim_head_ro (fdinfo + 4));
RDebugDesc *desc = r_debug_desc_new (atoi (de->d_name), buf, perm, type, offset);

View File

@ -842,7 +842,6 @@ static int xnu_write_mem_maps_to_buffer(RBuffer *buffer, RList *mem_maps, int st
// xfer_foffset += xfer_size;
}
}
hoffset += segment_command_sz;
foffset += curr_map->size;
vmoffset += curr_map->size;

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2021 - pancake, nibble, maijin */
/* radare - LGPL - Copyright 2009-2022 - pancake, nibble, maijin */
#include <r_anal.h>
#include <r_asm.h>
@ -34,10 +34,9 @@ static RAsmState *__as_new(void) {
if (as) {
as->l = r_lib_new (NULL, NULL);
as->a = r_asm_new ();
if (as->a) {
as->a->num = r_num_new (NULL, NULL, NULL);
}
as->anal = r_anal_new ();
r_unref (as->anal->config);
as->a->num = r_num_new (NULL, NULL, NULL);
as->anal->config = r_ref (as->a->config);
r_anal_bind (as->anal, &as->a->analb);
__load_plugins (as);