Skip to content

Commit

Permalink
Fix #16455 - iij asserts for ld-uclibc with a null import ##bin (#1…
Browse files Browse the repository at this point in the history
…6509)

* Fix asserts in `iij` for ld-uclibc with a null import ##bin
* Add test for `iij` on ld-uclibc
  • Loading branch information
radare authored Apr 10, 2020
1 parent 388df51 commit af51074
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libr/core/cbin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1849,13 +1849,16 @@ static int bin_imports(RCore *r, int mode, int va, const char *name) {
str = r_str_replace (str, "\"", "\\\"", 1);

pj_ki (pj, "ordinal", import->ordinal);
pj_ks (pj, "bind", import->bind);
pj_ks (pj, "type", import->type);
if (import->bind) {
pj_ks (pj, "bind", import->bind);
}
if (import->type) {
pj_ks (pj, "type", import->type);
}
if (import->classname && import->classname[0]) {
pj_ks (pj, "classname", import->classname);
pj_ks (pj, "descriptor", import->descriptor);
}

pj_ks (pj, "name", str);
if (libname) {
pj_ks (pj, "libname", libname);
Expand Down
16 changes: 16 additions & 0 deletions test/new/db/formats/elf/crash
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,19 @@ EXPECT=<<EOF

EOF
RUN

NAME=ELF: ld-uclibc
FILE=../bins/elf/ld-uClibc-0.9.33.2.so
CMDS=<<EOF
ii
iij
EOF
EXPECT=<<EOF
[Imports]
nth vaddr bind type lib name
---------------------------------
0 0x00000000 NONE NONE

[{"ordinal":0,"name":"","plt":0}]
EOF
RUN

0 comments on commit af51074

Please sign in to comment.