mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-05 04:50:43 +00:00
Fix more crashes on DEX
This commit is contained in:
parent
a7fc3eedc3
commit
acade3fee7
@ -251,15 +251,17 @@ static void get_strings_range(RBinFile *arch, RList *list, int min, ut64 from, u
|
||||
|
||||
static int is_data_section(RBinFile *a, RBinSection *s) {
|
||||
RBinObject *o = a->o;
|
||||
if (strstr (o->info->bclass, "MACH0") && strstr (s->name, "_cstring")) // OSX
|
||||
return 1;
|
||||
if (strstr (o->info->bclass, "ELF") && strstr (s->name, "data") && !strstr (s->name, "rel")) // LINUX
|
||||
return 1;
|
||||
if (o && o->info && o->info->bclass) {
|
||||
if (strstr (o->info->bclass, "MACH0") && strstr (s->name, "_cstring")) // OSX
|
||||
return 1;
|
||||
if (strstr (o->info->bclass, "ELF") && strstr (s->name, "data") && !strstr (s->name, "rel")) // LINUX
|
||||
return 1;
|
||||
#define X 1
|
||||
#define ROW (4|2)
|
||||
if (strstr (o->info->bclass, "PE") && s->srwx & ROW && !(s->srwx&X) && s->size>0 ) {
|
||||
if (!strcmp (s->name, ".rdata")) // Maybe other sections are interesting too?
|
||||
return 1;
|
||||
if (strstr (o->info->bclass, "PE") && s->srwx & ROW && !(s->srwx&X) && s->size>0 ) {
|
||||
if (!strcmp (s->name, ".rdata")) // Maybe other sections are interesting too?
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (strstr (s->name, "_const")) // Rust
|
||||
return 1;
|
||||
|
@ -184,13 +184,13 @@ static RList* strings (RBinFile *arch) {
|
||||
|
||||
if (bin->header.strings_size>bin->size) {
|
||||
bin->strings = NULL;
|
||||
return R_FALSE;
|
||||
return NULL;
|
||||
}
|
||||
if (!(ret = r_list_new ()))
|
||||
return NULL;
|
||||
ret->free = free;
|
||||
for (i = 0; i < bin->header.strings_size; i++) {
|
||||
if (!(ptr = R_NEW (RBinString)))
|
||||
if (!(ptr = R_NEW0 (RBinString)))
|
||||
break;
|
||||
r_buf_read_at (bin->b, bin->strings[i], (ut8*)&buf, 6);
|
||||
len = dex_read_uleb128 (buf);
|
||||
@ -200,6 +200,7 @@ static RList* strings (RBinFile *arch) {
|
||||
ptr->string[(int) len+1]='\0';
|
||||
ptr->vaddr = ptr->paddr = bin->strings[i];
|
||||
ptr->size = len;
|
||||
ptr->length = len;
|
||||
ptr->ordinal = i+1;
|
||||
r_list_append (ret, ptr);
|
||||
} else {
|
||||
@ -416,9 +417,9 @@ static int dex_loadcode(RBinFile *arch, RBinDexObj *bin) {
|
||||
dprintf (" virtual methods: %u\n", (ut32)VM);
|
||||
for (j=0; j<VM; j++) {
|
||||
ut64 MI, MA, MC;
|
||||
p = r_uleb128 (p, ST32_MAX, &MI);
|
||||
p = r_uleb128 (p, ST32_MAX, &MA);
|
||||
p = r_uleb128 (p, ST32_MAX, &MC);
|
||||
p = r_uleb128 (p, p_end-p, &MI);
|
||||
p = r_uleb128 (p, p_end-p, &MA);
|
||||
p = r_uleb128 (p, p_end-p, &MC);
|
||||
|
||||
if (MI<bin->header.method_size) methods[MI] = 1;
|
||||
if (bin->code_from>MC) bin->code_from = MC;
|
||||
|
Loading…
x
Reference in New Issue
Block a user