Hackaround for pie bins

This commit is contained in:
pancake 2014-10-08 01:54:09 +02:00
parent 348b494e8c
commit abd7bcda90
3 changed files with 6 additions and 2 deletions

View File

@ -516,6 +516,7 @@ if (strcmp (argv[optind-1], "--")) {
#if USE_THREADS
if (run_anal>0 && threaded) {
// XXX: if no rabin2 in path that may fail
// TODO: pass -B 0 ? for pie bins?
rabin_cmd = r_str_newf ("rabin2 -rSIeMzisR%s %s",
(debug||r.io->va)?"":"p", r.file->desc->name);
/* TODO: only load data if no project is used */

View File

@ -840,7 +840,6 @@ static RBinObject * r_bin_object_new (RBinFile *binfile, RBinPlugin *plugin, ut6
static int r_bin_file_set_bytes (RBinFile *binfile, const ut8 * bytes, ut64 sz) {
if (!bytes) return R_FALSE;
if (binfile->buf) r_buf_free (binfile->buf);
binfile->buf = r_buf_new ();
r_buf_set_bytes (binfile->buf, bytes, sz);
@ -874,7 +873,7 @@ static RBinFile * r_bin_file_new (RBin *bin, const char *file, const ut8 * bytes
char fdkey[128];
snprintf (fdkey, sizeof (fdkey)-1, "fd.%i", fd);
binfile->sdb = sdb_ns (sdb, fdkey, 1);
sdb_set (binfile->sdb, "archs", "0:0:x86:32", 0);
sdb_set (binfile->sdb, "archs", "0:0:x86:32", 0); // x86??
/* NOTE */
/* Those refs++ are necessary because sdb_ns() doesnt rerefs all sub-namespaces */
/* And if any namespace is referenced backwards it gets double-freed */

View File

@ -19,6 +19,10 @@ static ut64 rva (RBin *bin, int va, ut64 paddr, ut64 vaddr, ut64 baddr, ut64 lad
}
if (laddr == UT64_MAX)
va = 0;
if (va == 2) {
if (!baddr) baddr=1;
// hackaround for PIE bins
}
switch (va) {
case 0: // pa $ rabin2 -p
return paddr;