mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 05:40:10 +00:00
Fix some issues reported by clang-analyzer
This commit is contained in:
parent
dc185e242a
commit
b29f5bb54a
@ -785,6 +785,7 @@ static bool parseOperands(char* str, ArmOp *op) {
|
||||
op->operands[operand].reg_type = ARM_REG64;
|
||||
op->operands[operand].reg = r_num_math (NULL, token + 1);
|
||||
if (op->operands[operand].reg > 31) {
|
||||
free (t);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -794,6 +795,7 @@ static bool parseOperands(char* str, ArmOp *op) {
|
||||
op->operands[operand].reg_type = ARM_REG32;
|
||||
op->operands[operand].reg = r_num_math (NULL, token + 1);
|
||||
if (op->operands[operand].reg > 31) {
|
||||
free (t);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -207,7 +207,7 @@ int dcpu16_assemble (ut8* out, const char* unoline) {
|
||||
ut16 wordA = 0, wordB = 0;
|
||||
int basic_opcode = 0;
|
||||
int non_basic_opcode = 0;
|
||||
char line[256], *param;
|
||||
char line[256] = {0}, *param;
|
||||
int off = 0;
|
||||
// uberflow!
|
||||
clean_line (line, unoline);
|
||||
|
@ -4583,7 +4583,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
r_cons_printf (",\"addr\":%"PFMT64u, f->addr);
|
||||
r_cons_printf (",\"ops\":[");
|
||||
// instructions are all outputted as a json list
|
||||
cont_size = f->_size > 0 ? f->_size : r_anal_fcn_realsize (f);
|
||||
// DEAD CODE cont_size = f->_size > 0 ? f->_size : r_anal_fcn_realsize (f);
|
||||
bool first = true;
|
||||
bool prev_result = true;
|
||||
// TODO: can loc jump to another locs?
|
||||
|
@ -1673,6 +1673,7 @@ static void fix_back_edge_dummy_nodes (RAGraph *g, RANode *from, RANode *to) {
|
||||
}
|
||||
|
||||
static int get_nth (const RAGraph *g, RANode *src, RANode *dst);
|
||||
|
||||
void backedge_info (RAGraph *g) {
|
||||
int i, j, k;
|
||||
int min, max;
|
||||
@ -1826,8 +1827,8 @@ void backedge_info (RAGraph *g) {
|
||||
e->is_reversed = true;
|
||||
e->from = NULL;
|
||||
e->to = NULL;
|
||||
e->x = r_list_new();
|
||||
e->y = r_list_new();
|
||||
e->x = r_list_new ();
|
||||
e->y = r_list_new ();
|
||||
if (g->layout == 0) {
|
||||
r_list_append (e->y, (void *) (size_t) (n->y + g->layers[g->n_layers - 1].height + 2 + outedge));
|
||||
} else {
|
||||
|
@ -244,14 +244,10 @@ void aes_decrypt (struct aes_state *st, ut8 *in, ut8 *result) {
|
||||
|
||||
// Apply round transforms
|
||||
for (r = 1; r < st->rounds; r++) {
|
||||
a0 = (RT0[(ut8)(t0 >> 24)] ^ RT1[(ut8)(t3 >> 16)] ^ RT2[(ut8)(t2 >> 8)] ^
|
||||
RT3[(ut8)t1]);
|
||||
a1 = (RT0[(ut8)(t1 >> 24)] ^ RT1[(ut8)(t0 >> 16)] ^ RT2[(ut8)(t3 >> 8)] ^
|
||||
RT3[(ut8)t2]);
|
||||
a2 = (RT0[(ut8)(t2 >> 24)] ^ RT1[(ut8)(t1 >> 16)] ^ RT2[(ut8)(t0 >> 8)] ^
|
||||
RT3[(ut8)t3]);
|
||||
a3 = (RT0[(ut8)(t3 >> 24)] ^ RT1[(ut8)(t2 >> 16)] ^ RT2[(ut8)(t1 >> 8)] ^
|
||||
RT3[(ut8)t0]);
|
||||
a0 = (RT0[(ut8)(t0 >> 24)] ^ RT1[(ut8)(t3 >> 16)] ^ RT2[(ut8)(t2 >> 8)] ^ RT3[(ut8)t1]);
|
||||
a1 = (RT0[(ut8)(t1 >> 24)] ^ RT1[(ut8)(t0 >> 16)] ^ RT2[(ut8)(t3 >> 8)] ^ RT3[(ut8)t2]);
|
||||
a2 = (RT0[(ut8)(t2 >> 24)] ^ RT1[(ut8)(t1 >> 16)] ^ RT2[(ut8)(t0 >> 8)] ^ RT3[(ut8)t3]);
|
||||
a3 = (RT0[(ut8)(t3 >> 24)] ^ RT1[(ut8)(t2 >> 16)] ^ RT2[(ut8)(t1 >> 8)] ^ RT3[(ut8)t0]);
|
||||
t0 = a0 ^ expkey[1][r][0];
|
||||
t1 = a1 ^ expkey[1][r][1];
|
||||
t2 = a2 ^ expkey[1][r][2];
|
||||
|
@ -178,7 +178,7 @@ R_API int r_debug_reg_list(RDebug *dbg, int type, int size, int rad, const char
|
||||
if (tolower ((ut8)rad) == 'j') {
|
||||
snprintf (strvalue, sizeof (strvalue),"%"PFMT64u, value);
|
||||
} else {
|
||||
if (pr->wide_offsets && dbg->bits & R_SYS_BITS_64) {
|
||||
if (pr && pr->wide_offsets && dbg->bits & R_SYS_BITS_64) {
|
||||
snprintf (strvalue, sizeof (strvalue),"0x%016"PFMT64x, value);
|
||||
} else {
|
||||
snprintf (strvalue, sizeof (strvalue),"0x%08"PFMT64x, value);
|
||||
|
@ -170,8 +170,8 @@ static int parse (RParse *p, const char *data, char *str) {
|
||||
if (!(buf = strdup (data))) {
|
||||
return false;
|
||||
}
|
||||
*w0 = *w1 = *w2 = *w3 = '\0';
|
||||
if (*buf) {
|
||||
*w0 = *w1 = *w2 = *w3 = '\0';
|
||||
end = strchr (buf, '\0');
|
||||
ptr = strchr (buf, ' ');
|
||||
if (!ptr) {
|
||||
|
Loading…
Reference in New Issue
Block a user