mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-01 09:00:46 +00:00
Fix new defects in various files
* Remove unnecessary NULL check in __demangleAs() * Remove unnecessary NULL check in r_io_fd_seek() * Add missing break in ARM32 COFF case and fix test * Add missing NULL checks for r_io_bank_get() result * Add missing NULL checks in r_bin_demangle() * Add missing NULL check for r_io_submap_new() result * Fix improper failure check in risv_assemble() * Add missing break in open command * Document fall-through case in dalvik anal
This commit is contained in:
parent
c6929b6231
commit
0747bcd8e2
@ -851,6 +851,7 @@ static int dalvik_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int l
|
||||
case 0x8b: // double-to-long
|
||||
case 0x8c: // double-to-float
|
||||
op->family = R_ANAL_OP_FAMILY_FPU;
|
||||
/* fall through */
|
||||
case 0x8d: // int-to-byte
|
||||
case 0x8e: // int-to-char
|
||||
case 0x8f: // int-to-short
|
||||
|
@ -205,7 +205,7 @@ R_IPI int riscv_assemble(const char *str, ut64 pc, ut8 *out) {
|
||||
invalid = true;
|
||||
break;
|
||||
}
|
||||
if (!invalid) {
|
||||
if (invalid) {
|
||||
free (s);
|
||||
op = ops[i].op;
|
||||
return riscv_ri (out, op, rs, imm);
|
||||
|
@ -94,7 +94,7 @@ R_API char *r_bin_demangle(RBinFile *bf, const char *def, const char *str, ut64
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
if (found && bin && bin->file) {
|
||||
size_t len = strlen (bin->file);
|
||||
if (!r_str_ncasecmp (str, bin->file, len)) {
|
||||
lib = bin->file;
|
||||
|
@ -558,6 +558,7 @@ static RBinInfo *info(RBinFile *bf) {
|
||||
ret->machine = strdup ("ARM");
|
||||
ret->arch = strdup ("arm");
|
||||
ret->bits = 32;
|
||||
break;
|
||||
case COFF_FILE_MACHINE_AMD64:
|
||||
ret->machine = strdup ("AMD64");
|
||||
ret->arch = strdup ("x86");
|
||||
|
@ -1608,6 +1608,7 @@ static int cmd_open(void *data, const char *input) {
|
||||
break;
|
||||
case '?': // "oa?"
|
||||
r_core_cmd_help (core, help_msg_oa);
|
||||
return 1;
|
||||
break;
|
||||
case ' ': // "oa "
|
||||
{
|
||||
@ -1656,6 +1657,7 @@ static int cmd_open(void *data, const char *input) {
|
||||
r_core_cmd_help (core, help_msg_oa);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 'n': // "on"
|
||||
if (input[1] == '?') {
|
||||
r_core_cmd_help (core, help_msg_on);
|
||||
|
@ -768,6 +768,7 @@ R_API RList *r_core_get_boundaries_prot(RCore *core, R_UNUSED int perm, const ch
|
||||
RIOBank *bank = r_io_bank_get (core->io, core->io->bank);
|
||||
RListIter *iter;
|
||||
RIOMapRef *mapref;
|
||||
if (bank) {
|
||||
r_list_foreach (bank->maprefs, iter, mapref) {
|
||||
RIOMap *map = r_io_map_get_by_ref (core->io, mapref);
|
||||
const ut64 from = r_io_map_begin (map);
|
||||
@ -790,6 +791,7 @@ R_API RList *r_core_get_boundaries_prot(RCore *core, R_UNUSED int perm, const ch
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (end != UT64_MAX) {
|
||||
append_bound (list, NULL, search_itv, begin, end - begin, 7);
|
||||
}
|
||||
@ -813,6 +815,7 @@ R_API RList *r_core_get_boundaries_prot(RCore *core, R_UNUSED int perm, const ch
|
||||
RIOBank *bank = r_io_bank_get (core->io, core->io->bank);
|
||||
RListIter *iter;
|
||||
RIOMapRef *mapref;
|
||||
if (bank) {
|
||||
r_list_foreach (bank->maprefs, iter, mapref) {
|
||||
RIOMap *map = r_io_map_get_by_ref (core->io, mapref);
|
||||
const ut64 from = r_io_map_begin (map);
|
||||
@ -823,6 +826,7 @@ R_API RList *r_core_get_boundaries_prot(RCore *core, R_UNUSED int perm, const ch
|
||||
append_bound (list, core->io, search_itv, from, r_io_map_size (map), rwx);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (r_str_startswith (mode, "bin.segments")) {
|
||||
int len = strlen ("bin.segments.");
|
||||
int mask = (mode[len - 1] == '.')? r_str_rwx (mode + len): 0;
|
||||
@ -879,6 +883,7 @@ R_API RList *r_core_get_boundaries_prot(RCore *core, R_UNUSED int perm, const ch
|
||||
} else {
|
||||
RIOBank *bank = r_io_bank_get (core->io, core->io->bank);
|
||||
RIOMapRef *mapref;
|
||||
if (bank) {
|
||||
r_list_foreach (bank->maprefs, iter, mapref) {
|
||||
RIOMap *map = r_io_map_get_by_ref (core->io, mapref);
|
||||
const ut64 from = r_io_map_begin (map);
|
||||
@ -891,6 +896,7 @@ R_API RList *r_core_get_boundaries_prot(RCore *core, R_UNUSED int perm, const ch
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
append_bound (list, core->io, search_itv, from, to-from, 1);
|
||||
}
|
||||
} else if (r_str_startswith (mode, "bin.sections")) {
|
||||
|
@ -426,6 +426,9 @@ static void _delete_submaps_from_bank_tree(RIO *io, RIOBank *bank, RListIter *pr
|
||||
RIOMapRef *mapref = _mapref_from_map (map);
|
||||
bd = r_io_submap_new (io, mapref);
|
||||
free (mapref);
|
||||
if (!bd) {
|
||||
continue;
|
||||
}
|
||||
if (r_io_submap_from (sm) >= r_io_map_from (map)) {
|
||||
// case 4 and 2
|
||||
r_io_submap_set_from (bd, r_io_submap_from (sm));
|
||||
|
@ -39,7 +39,7 @@ R_API int r_io_fd_write(RIO *io, int fd, const ut8 *buf, int len) {
|
||||
|
||||
R_API ut64 r_io_fd_seek(RIO *io, int fd, ut64 addr, int whence) {
|
||||
r_return_val_if_fail (io, UT64_MAX);
|
||||
return io? r_io_desc_seek (r_io_desc_get (io, fd), addr, whence): UT64_MAX;
|
||||
return r_io_desc_seek (r_io_desc_get (io, fd), addr, whence);
|
||||
}
|
||||
|
||||
R_API ut64 r_io_fd_size(RIO *io, int fd) {
|
||||
|
@ -526,7 +526,7 @@ static void setup_trylib_from_environment(RBin *bin, int type) {
|
||||
}
|
||||
|
||||
static char *__demangleAs(RBin *bin, int type, const char *file) {
|
||||
bool syscmd = bin? bin->demangle_usecmd: false;
|
||||
bool syscmd = bin->demangle_usecmd;
|
||||
char *res = NULL;
|
||||
switch (type) {
|
||||
case R_BIN_NM_CXX: res = r_bin_demangle_cxx (NULL, file, 0); break;
|
||||
|
@ -7,8 +7,8 @@ e asm.bits
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
format coff
|
||||
x86
|
||||
64
|
||||
arm
|
||||
32
|
||||
EOF
|
||||
RUN
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user