Skip to content
Permalink
Browse files
Accept newer dex magic bytes and attempt to parse future versions.
Currently if a ICS+ extended opcode file was passed to radare2 it
would fail to parse it properly. This checks for the two conditions
'dex\n035\0' and 'dex\n036\0' - and will also just attempt to parse
it if the magic bytes 'dex\n' are available. This should suffice since
the last four bytes are the versioning bytes.
  • Loading branch information
strazzere committed Jan 23, 2013
1 parent 4ffa795 commit 3fcc031083016385fa201b3885896c758393d7f4
Showing 1 changed file with 9 additions and 5 deletions.
@@ -19,12 +19,16 @@ static ut64 baddr(RBinArch *arch) {
static int check(RBinArch *arch) {
if (!arch->buf || !arch->buf->buf)
return R_FALSE;
if (!memcmp (arch->buf->buf, "dex\n035\0", 8))
return R_TRUE;
if (!memcmp (arch->buf->buf, "dex\n035\0", 8)) // Non-extended opcode dex file
return R_TRUE;
else if (!memcmp (arch->buf->buf, "dex\n036\0", 8)) // Extended (jumnbo) opcode dex file, ICS+ only (sdk level 14+)
return R_TRUE;
else if (!memcmp (arch->buf->buf, "dex\n009\0", 8)) // M3 (Nov-Dec 07)
return R_TRUE;
else if (!memcmp (arch->buf->buf, "dex\n009\0", 8)) // M5 (Feb-Mar 08)
return R_TRUE;
return R_TRUE;
else if (!memcmp (arch->buf->buf, "dex\n009\0", 8)) // M5 (Feb-Mar 08)
return R_TRUE;
else if (!memcmp (arch->buf->buf, "dex\n", 4)) // Default fall through, should still be a dex file
return R_TRUE;
return R_FALSE;
}

0 comments on commit 3fcc031

Please sign in to comment.