Skip to content

Commit 44744db

Browse files
authored
Enlarge symbol name limits aligned to flag sizes ##bin
1 parent 0f59321 commit 44744db

File tree

5 files changed

+27
-31
lines changed

5 files changed

+27
-31
lines changed

libr/anal/fcn.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
/* speedup analysis by removing some function overlapping checks */
2020
#define JAYRO_04 1
2121

22-
// 16 KB is the maximum size for a basic block
23-
#define MAX_FLG_NAME_SIZE 64
24-
2522
#define FIX_JMP_FWD 0
2623
#define D if (a->verbose)
2724

libr/bin/format/elf/elf_specs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#ifndef _INCLUDE_ELF_SPECS_H
5959
#define _INCLUDE_ELF_SPECS_H
6060

61-
#define ELF_STRING_LENGTH 256
61+
#define ELF_STRING_LENGTH 512
6262

6363
// not strictly ELF, but close enough:
6464
#define CGCMAG "\177CGC"

libr/bin/format/objc/mach0_classes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
#include "mach0_classes.h"
77

88
#define RO_META (1 << 0)
9-
#define MAX_CLASS_NAME_LEN 256
9+
// should be aligned to R_FLAG_NAME_SIZE i guess
10+
#define MAX_CLASS_NAME_LEN 512
1011
#define MAX_SWIFT_MEMBERS 256
1112

1213
#ifdef R_BIN_MACH064

libr/core/cbin.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,8 +2347,6 @@ static const char *symbol_flag_prefix(RBinSymbol *sym) {
23472347
return "sym";
23482348
}
23492349

2350-
#define MAXFLAG_LEN_DEFAULT 128
2351-
23522350
static char *construct_symbol_flagname(const char *pfx, const char *libname, const char *symname, int len) {
23532351
char *s = r_str_newf ("%s.%s%s%s", pfx, r_str_get (libname), libname ? "_" : "", symname);
23542352
if (s) {
@@ -2390,12 +2388,12 @@ static void snInit(RCore *core, SymName *sn, RBinSymbol *sym, const char *lang,
23902388
resymname = r_str_newf ("%s_%d", sym_name, sym->dup_count);
23912389
symname = resymname;
23922390
}
2393-
sn->nameflag = construct_symbol_flagname (pfx, sym->libname, symname, MAXFLAG_LEN_DEFAULT);
2391+
sn->nameflag = construct_symbol_flagname (pfx, sym->libname, symname, R_FLAG_NAME_SIZE);
23942392
free (resymname);
23952393
if (R_STR_ISNOTEMPTY (sym->classname)) {
23962394
sn->classname = strdup (sym->classname);
23972395
sn->classflag = r_str_newf ("sym.%s.%s", sn->classname, sn->name);
2398-
r_name_filter (sn->classflag, MAXFLAG_LEN_DEFAULT);
2396+
r_name_filter (sn->classflag, R_FLAG_NAME_SIZE);
23992397
sn->methname = r_str_newf ("%s::%s", sn->classname, sym_name);
24002398
sn->methflag = r_str_newf ("sym.%s.%s", sn->classname, sym_name);
24012399
r_name_filter (sn->methflag, strlen (sn->methflag));
@@ -2715,7 +2713,7 @@ static bool bin_symbols(RCore *core, PJ *pj, int mode, ut64 laddr, int va, ut64
27152713
lastfs = 's';
27162714
}
27172715
if (core->bin->prefix || *n) { // we don't want unnamed symbol flags
2718-
char *flagname = construct_symbol_flagname ("sym", sn.libname, n, MAXFLAG_LEN_DEFAULT);
2716+
char *flagname = construct_symbol_flagname ("sym", sn.libname, n, R_FLAG_NAME_SIZE);
27192717
if (!flagname) {
27202718
goto next;
27212719
}

test/db/formats/dwarf

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -733,28 +733,28 @@ colu: 1
733733
addr: 0x00001176
734734
EOF
735735
EXPECT_ERR=<<EOF
736-
DEBUG: [cbin.c:3404] (section .dynsym) Cd 8[21] @ 0x3d8
737-
DEBUG: [cbin.c:3404] (section .dynstr) Css 141 @ 0x480
738-
DEBUG: [cbin.c:3404] (section .rela.dyn) Cd 8[24] @ 0x550
739-
DEBUG: [cbin.c:3404] (section .rela.plt) Cd 8[3] @ 0x610
740-
DEBUG: [cbin.c:3404] (section .init_array) Cd 8[1] @ 0x3db8
741-
DEBUG: [cbin.c:3404] (section .fini_array) Cd 8[1] @ 0x3dc0
742-
DEBUG: [cbin.c:3404] (section .dynamic) Cd 8[62] @ 0x3dc8
743-
DEBUG: [cbin.c:3404] (section .got) Cd 8[9] @ 0x3fb8
744-
DEBUG: [cbin.c:3404] (section .dynsym) Cd 8[21] @ 0x3d8
745-
DEBUG: [cbin.c:3404] (section .dynstr) Css 141 @ 0x480
746-
DEBUG: [cbin.c:3404] (section .rela.dyn) Cd 8[24] @ 0x550
747-
DEBUG: [cbin.c:3404] (section .rela.plt) Cd 8[3] @ 0x610
748-
DEBUG: [cbin.c:3404] (section .init_array) Cd 8[1] @ 0x3db8
749-
DEBUG: [cbin.c:3404] (section .fini_array) Cd 8[1] @ 0x3dc0
750-
DEBUG: [cbin.c:3404] (section .dynamic) Cd 8[62] @ 0x3dc8
751-
DEBUG: [cbin.c:3404] (section .got) Cd 8[9] @ 0x3fb8
736+
DEBUG: [cbin.c:3402] (section .dynsym) Cd 8[21] @ 0x3d8
737+
DEBUG: [cbin.c:3402] (section .dynstr) Css 141 @ 0x480
738+
DEBUG: [cbin.c:3402] (section .rela.dyn) Cd 8[24] @ 0x550
739+
DEBUG: [cbin.c:3402] (section .rela.plt) Cd 8[3] @ 0x610
740+
DEBUG: [cbin.c:3402] (section .init_array) Cd 8[1] @ 0x3db8
741+
DEBUG: [cbin.c:3402] (section .fini_array) Cd 8[1] @ 0x3dc0
742+
DEBUG: [cbin.c:3402] (section .dynamic) Cd 8[62] @ 0x3dc8
743+
DEBUG: [cbin.c:3402] (section .got) Cd 8[9] @ 0x3fb8
744+
DEBUG: [cbin.c:3402] (section .dynsym) Cd 8[21] @ 0x3d8
745+
DEBUG: [cbin.c:3402] (section .dynstr) Css 141 @ 0x480
746+
DEBUG: [cbin.c:3402] (section .rela.dyn) Cd 8[24] @ 0x550
747+
DEBUG: [cbin.c:3402] (section .rela.plt) Cd 8[3] @ 0x610
748+
DEBUG: [cbin.c:3402] (section .init_array) Cd 8[1] @ 0x3db8
749+
DEBUG: [cbin.c:3402] (section .fini_array) Cd 8[1] @ 0x3dc0
750+
DEBUG: [cbin.c:3402] (section .dynamic) Cd 8[62] @ 0x3dc8
751+
DEBUG: [cbin.c:3402] (section .got) Cd 8[9] @ 0x3fb8
752752
WARN: [cbin.c:1943] Relocs has not been applied. Please use `-e bin.relocs.apply=true` or `-e bin.cache=true` next time
753-
DEBUG: [cbin.c:2632] Cannot resolve symbol address __libc_start_main
754-
DEBUG: [cbin.c:2632] Cannot resolve symbol address _ITM_deregisterTMCloneTable
755-
DEBUG: [cbin.c:2632] Cannot resolve symbol address __gmon_start__
756-
DEBUG: [cbin.c:2632] Cannot resolve symbol address _ITM_registerTMCloneTable
757-
DEBUG: [cbin.c:2632] Cannot resolve symbol address __cxa_finalize
753+
DEBUG: [cbin.c:2630] Cannot resolve symbol address __libc_start_main
754+
DEBUG: [cbin.c:2630] Cannot resolve symbol address _ITM_deregisterTMCloneTable
755+
DEBUG: [cbin.c:2630] Cannot resolve symbol address __gmon_start__
756+
DEBUG: [cbin.c:2630] Cannot resolve symbol address _ITM_registerTMCloneTable
757+
DEBUG: [cbin.c:2630] Cannot resolve symbol address __cxa_finalize
758758
EOF
759759
RUN
760760

0 commit comments

Comments
 (0)