mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-28 15:41:38 +00:00
Fix ELF loader and segfault in disasm->hexdump
This commit is contained in:
parent
9f35d56085
commit
38628b4e17
@ -922,7 +922,7 @@ struct r_bin_elf_symbol_t* Elf_(r_bin_elf_get_symbols)(struct Elf_(r_bin_elf_obj
|
||||
perror ("realloc (symbols|imports)");
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
if (bin->baddr) {
|
||||
int idx = sym[k].st_shndx;
|
||||
if (idx>=0 && idx < bin->ehdr.e_shnum) {
|
||||
if (bin->baddr && toffset>bin->baddr)
|
||||
|
@ -95,8 +95,7 @@ static RList* sections(RBinArch *arch) {
|
||||
if (r_list_empty (ret)) {
|
||||
if (!arch->size) {
|
||||
struct Elf_(r_bin_elf_obj_t) *bin = arch->bin_obj;
|
||||
if (bin) arch->size = bin->size;
|
||||
else arch->size = 0x9999; // XXX hack
|
||||
arch->size = bin? bin->size: 0x9999;
|
||||
}
|
||||
if (!(ptr = R_NEW (RBinSection)))
|
||||
return ret;
|
||||
|
@ -391,10 +391,13 @@ toro:
|
||||
continue;
|
||||
case R_META_TYPE_DATA:
|
||||
{
|
||||
int delta = at-mi->from;
|
||||
int hexlen = len - idx;
|
||||
int delta = at-mi->from;
|
||||
if (mi->size<hexlen)
|
||||
hexlen = mi->size;
|
||||
core->print->flags &= ~R_PRINT_FLAGS_HEADER;
|
||||
r_cons_printf ("hex length=%lld delta=%d\n", mi->size , delta);
|
||||
r_print_hexdump (core->print, at, buf+idx, mi->size-delta, 16, 1);
|
||||
r_print_hexdump (core->print, at, buf+idx, hexlen, 16, 1); //mi->size-delta, 16, 1);
|
||||
core->inc = 16;
|
||||
core->print->flags |= R_PRINT_FLAGS_HEADER;
|
||||
ret = (int)mi->size; //-delta;
|
||||
|
@ -318,7 +318,7 @@ R_API void r_print_hexdump(RPrint *p, ut64 addr, const ut8 *buf, int len, int ba
|
||||
if (j+1>=inc+i)
|
||||
p->printf (j%2?" |":"| ");
|
||||
else p->printf (j%2?" ":" ");
|
||||
} else p->printf (j%2?" ":" ");
|
||||
} else p->printf (j%2?" ":" ");
|
||||
continue;
|
||||
}
|
||||
if (base==32) {
|
||||
|
Loading…
Reference in New Issue
Block a user