Fix last covs and better dalvik pseudo

This commit is contained in:
pancake 2017-12-16 02:54:02 +01:00
parent 2ea61faaeb
commit e0deacc916
3 changed files with 29 additions and 15 deletions

View File

@ -2688,12 +2688,12 @@ R_API int r_core_anal_search_xrefs(RCore *core, ut64 from, ut64 to, int rad) {
block = malloc (core->blocksize);
if (!buf) {
eprintf ("Error: cannot allocate a block\n");
free (buf);
free (block);
return -1;
}
if (!block) {
eprintf ("Error: cannot allocate a temp block\n");
free (block);
free (buf);
return -1;
}
if (rad == 'j') {

View File

@ -17,10 +17,11 @@ static int replace(int argc, const char *argv[], char *newstr) {
char *str;
} ops[] = {
{ "rsub-int", "1 = 2 - 3"},
{ "float-to-double", "1 = (double) 2"},
{ "float-to-long", "1 = (long) 2"},
{ "float-to-int", "1 = (int) 2"},
{ "long-to-float", "1 = (float) 2"},
{ "float-to-double", "1 = (double)(float) 2"},
{ "float-to-long", "1 = (long)(float) 2"},
{ "float-to-int", "1 = (int)(float) 2"},
{ "long-to-float", "1 = (float)(long) 2"},
{ "long-to-int", "1 = (int)(long) 2"},
{ "long-to-double", "1 = (double) 2"},
{ "double-to-long", "1 = (long) 2"},
{ "double-to-int", "1 = (int) 2"},
@ -69,11 +70,13 @@ static int replace(int argc, const char *argv[], char *newstr) {
{ "shr-long/2addr", "1 >>= 2"},
{ "shr-long", "1 = (long) 2 >> 3"},
{ "shr-int", "1 = (int) 2 >> 3"},
{ "ushr-int", "1 >>>= (int) 2"},
{ "ushr-int", "1 = (int) 2 >>> 3"},
{ "ushr-int/2addr", "1 >>>= 2"},
{ "ushr-long", "1 = (long) 2 >>> 3"},
{ "ushl-int/2addr", "1 <<<= 2"},
{ "shl-int/2addr", "1 <<<= 2"},
{ "shl-int", "1 = 2 << 3"},
{ "shl-int", "1 = (int) 2 << 3"},
{ "shl-long", "1 = (long) 2 << 3"},
{ "move/from16", "1 = 2"},
{ "move-exception", "1 = exception"},
{ "move-result", "1 = result"},
@ -91,9 +94,11 @@ static int replace(int argc, const char *argv[], char *newstr) {
{ "rem-float", "1 = (float) 2 % 3"},
{ "rem-long/2addr", "1 %= 2"},
{ "rem-float/2addr", "1 %= (float) 2"},
{ "rem-double/2addr", "1 %= (double) 2"},
{ "instance-of", "1 = insteanceof (2) == 3"},
{ "aput", "2[3] = 1"},
{ "aput-byte", "2[3] = (byte) 1"},
{ "aput-short", "2[3] = (short) 1"},
{ "aput-object", "2[3] = (object) 1"},
{ "aput-wide", "2[3] = (wide) 1"},
{ "aput-char", "2[3] = (char) 1"},
@ -109,6 +114,8 @@ static int replace(int argc, const char *argv[], char *newstr) {
{ "sget-object", "1 = (object) 2"},
{ "iput", "2[3] = 1"},
{ "iput-object", "2[3] = (object) 1"},
{ "iput-byte", "2[3] = (byte) 1"},
{ "iput-char", "2[3] = (char) 1"},
{ "iput-boolean", "2[3] = (bool) 1"},
{ "sput-boolean", "2[3] = (bool) 1"},
{ "sput-char", "2[3] = (char) 1"},
@ -147,10 +154,14 @@ static int replace(int argc, const char *argv[], char *newstr) {
{ "+invoke-virtual-quick", "call 2 1"},
{ "+invoke-interface/range", "call 2 1"},
{ "invoke-interface/range", "call 2 1"},
{ "div-float/2addr", "1 /= 2"},
{ "div-float/2addr", "1 /= (float) 2"},
{ "div-double/2addr", "1 /= (double) 2"},
{ "div-double", "1 = (double) 2 / 3"},
{ "div-float", "1 = 2 / 3"},
{ "div-int/lit8", "1 = 2 / 3"},
{ "div-int/lit16", "1 = 2 / 3"},
{ "div-int/2addr", "1 /= 2"},
{ "div-int", "1 = (int)(2 / 3)"},
{ "goto/16", "goto 1"},
{ "goto/32", "goto 1"},
{ "or-int", "1 = (int)(2 | 3)"},
@ -161,7 +172,6 @@ static int replace(int argc, const char *argv[], char *newstr) {
{ "sub-int", "1 = (int)(2 - 3)"},
{ "if-nez", "if (1) goto 2"},
{ "if-ltz", "if (1 <=) goto 2"},
{ "div-int", "1 = (int)(2 / 3)"},
{ "mul-int", "1 = (int)(2 * 3)"},
{ "mul-int/lit8", "1 = (2 * 3)"},
{ "check-cast", "if (1 instanceof 2)"},
@ -170,6 +180,7 @@ static int replace(int argc, const char *argv[], char *newstr) {
{ "add-int/lit16", "1 = 2 + 3"},
{ "add-int/2addr", "1 += 2"},
{ "add-double", "1 = (double)(2 + 3)"},
{ "add-double/2addr", "1 += (double)2"},
{ "mul-float/2addr", "1 *= 2"},
{ "mul-float", "1 = 2 * 3"},
{ "xor-long", "1 = (long)(2 ^ 3)"},

View File

@ -29,7 +29,7 @@ R_API char *r_hex_from_py_str(char *out, const char *code) {
return out;
}
const char *skip_comment_py(const char *code) {
static const char *skip_comment_py(const char *code) {
if (*code != '#') {
return code;
}
@ -51,8 +51,11 @@ R_API char *r_hex_from_py_array(char *out, const char *code) {
if (!comma) {
comma = strchr (code, ']');
}
char *word = r_str_ndup (code, comma - code);
char * _word = word;
if (!comma) {
break;
}
char * _word = r_str_ndup (code, comma - code);
const char *word = _word;
while (*word == ' ' || *word == '\t' || *word == '\n') {
word++;
word = skip_comment_py (word);
@ -175,8 +178,8 @@ R_API char *r_hex_from_c_array(char *out, const char *code) {
if (!comma) {
comma = strchr (code, '}');
}
const char *word = r_str_ndup (code, comma - code);
char * _word = word;
char * _word = r_str_ndup (code, comma - code);
const char *word = _word;
word = skip_comment_c (word);
while (*word == ' ' || *word == '\t' || *word == '\n') {
word++;