diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2015-12-16 19:45:47 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2015-12-16 19:45:47 (GMT) | 
| commit | e4b56188b664e6b986733d456e6a0ea9b2da6d53 (patch) | |
| tree | 5ee91a7b9f09a3d7550fbafde83c042f078689d3 /src | |
| parent | 7c40b70d6c1e1e13dadf876c8dda60b525616d47 (diff) | |
Dealt with empty ranges in the early states of disassembled symbols.
Diffstat (limited to 'src')
| -rw-r--r-- | src/arch/vmpa.c | 18 | ||||
| -rw-r--r-- | src/format/elf/helper_arm.c | 16 | 
2 files changed, 21 insertions, 13 deletions
diff --git a/src/arch/vmpa.c b/src/arch/vmpa.c index 4c2b4cf..a289a28 100644 --- a/src/arch/vmpa.c +++ b/src/arch/vmpa.c @@ -812,8 +812,24 @@ int cmp_mrange_with_vmpa(const mrange_t *a, const vmpa2t *b)      {          diff = compute_vmpa_diff(&a->addr, b); -        if (diff < a->length) +        /** +         * On prend en compte le cas très particulier des couvertures vides. +         * +         * C'est typiquement le cas avec les espaces de symboles pendant la +         * phase de désassemblage, après laquelle ces espaces deviennent bornés. +         * +         */ + +        if (diff == 0 && a->length == 0)              result = 0; + +        /** +         * Sinon on regarde simplement si l'adresse est contenue. +         */ + +        else if (diff < a->length) +            result = 0; +          else              result = 1; diff --git a/src/format/elf/helper_arm.c b/src/format/elf/helper_arm.c index f47df5d..f966296 100644 --- a/src/format/elf/helper_arm.c +++ b/src/format/elf/helper_arm.c @@ -118,30 +118,22 @@ bool load_elf_arm_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx,                  symbol = g_binary_symbol_new(STP_ROUTINE);                  g_binary_symbol_attach_routine(symbol, routine); -                g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);                  /* Comptabilisation pour le désassemblage brut */                  g_binary_format_register_code_point(G_BIN_FORMAT(format), virt, false); - -                /* -                printf("got a jump ! >> %d - %s\n", index, name); -                printf("  -->> val = 0x%08lx\n", ELF_SYM(format, sym, st_value)); -                printf("  -->> 0x%08lx  =>> 0x%08lx\n", (unsigned int)ELF_REL(format, reloc, r_offset), -                       ((unsigned int)ELF_SHDR(format, (*relxxx), sh_addr) + ELF_REL(format, reloc, r_offset))); -                */ - -                //symbol = g_binary_symbol_new(STP_FUNCTION)); -                //g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); -                  break;              default:                  printf("Relocation not supported (%lld) !\n", ELF_REL_TYPE(format, reloc)); +                symbol = NULL;                  break;          } +        if (symbol != NULL) +            _g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol, false); +      }      return result;  | 
