mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-26 17:15: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)");
|
perror ("realloc (symbols|imports)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
{
|
if (bin->baddr) {
|
||||||
int idx = sym[k].st_shndx;
|
int idx = sym[k].st_shndx;
|
||||||
if (idx>=0 && idx < bin->ehdr.e_shnum) {
|
if (idx>=0 && idx < bin->ehdr.e_shnum) {
|
||||||
if (bin->baddr && toffset>bin->baddr)
|
if (bin->baddr && toffset>bin->baddr)
|
||||||
|
@ -95,8 +95,7 @@ static RList* sections(RBinArch *arch) {
|
|||||||
if (r_list_empty (ret)) {
|
if (r_list_empty (ret)) {
|
||||||
if (!arch->size) {
|
if (!arch->size) {
|
||||||
struct Elf_(r_bin_elf_obj_t) *bin = arch->bin_obj;
|
struct Elf_(r_bin_elf_obj_t) *bin = arch->bin_obj;
|
||||||
if (bin) arch->size = bin->size;
|
arch->size = bin? bin->size: 0x9999;
|
||||||
else arch->size = 0x9999; // XXX hack
|
|
||||||
}
|
}
|
||||||
if (!(ptr = R_NEW (RBinSection)))
|
if (!(ptr = R_NEW (RBinSection)))
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -391,10 +391,13 @@ toro:
|
|||||||
continue;
|
continue;
|
||||||
case R_META_TYPE_DATA:
|
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;
|
core->print->flags &= ~R_PRINT_FLAGS_HEADER;
|
||||||
r_cons_printf ("hex length=%lld delta=%d\n", mi->size , delta);
|
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->inc = 16;
|
||||||
core->print->flags |= R_PRINT_FLAGS_HEADER;
|
core->print->flags |= R_PRINT_FLAGS_HEADER;
|
||||||
ret = (int)mi->size; //-delta;
|
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)
|
if (j+1>=inc+i)
|
||||||
p->printf (j%2?" |":"| ");
|
p->printf (j%2?" |":"| ");
|
||||||
else p->printf (j%2?" ":" ");
|
else p->printf (j%2?" ":" ");
|
||||||
} else p->printf (j%2?" ":" ");
|
} else p->printf (j%2?" ":" ");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (base==32) {
|
if (base==32) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user