Fix segfault in DEX parser, remove more r_print refs

This commit is contained in:
pancake 2013-01-23 01:53:32 +01:00
parent 4c2ad6cd58
commit 4ffa7952a2
9 changed files with 18 additions and 21 deletions

View File

@ -63,7 +63,7 @@ w32dist:
clean:
for a in libr binr shlr ; do (cd $$a ; ${MAKE} clean) ; done
mrproper:
distclean mrproper:
for a in libr binr shlr ; do ( cd $$a ; ${MAKE} mrproper) ; done
rm -f config-user.mk plugins.cfg libr/config.h
rm -f libr/include/r_userconf.h libr/config.mk
@ -181,5 +181,5 @@ tests:
include ${MKPLUGINS}
.PHONY: all clean mrproper install symstall uninstall deinstall dist shot pkgcfg
.PHONY: all clean distclean mrproper install symstall uninstall deinstall dist shot pkgcfg
.PHONY: r2-bindings r2-bindings-dist libr binr install-man w32dist tests

2
configure vendored
View File

@ -476,7 +476,7 @@ for A in ${ENVWORDS} ; do
SEDFLAGS="${SEDFLAGS}s,@${A}@,${VAR},g;"
done
SEDFLAGS="${SEDFLAGS}'"
for A in ./config-user.mk libr/include/r_userconf.h pkgcfg/r_io.pc pkgcfg/r_db.pc pkgcfg/r_magic.pc pkgcfg/r_asm.pc pkgcfg/r_bin.pc pkgcfg/r_anal.pc pkgcfg/r_hash.pc pkgcfg/r_cons.pc pkgcfg/r_diff.pc pkgcfg/r_core.pc pkgcfg/r_lang.pc pkgcfg/r_socket.pc pkgcfg/r_debug.pc pkgcfg/r_reg.pc pkgcfg/r_cmd.pc pkgcfg/r_config.pc pkgcfg/r_flags.pc pkgcfg/r_syscall.pc pkgcfg/r_sign.pc pkgcfg/r_util.pc pkgcfg/r_search.pc pkgcfg/r_bp.pc pkgcfg/r_lib.pc pkgcfg/r_parse.pc pkgcfg/r_print.pc pkgcfg/r_fs.pc ; do # SUBDIRS
for A in ./config-user.mk libr/include/r_userconf.h pkgcfg/r_io.pc pkgcfg/r_db.pc pkgcfg/r_magic.pc pkgcfg/r_asm.pc pkgcfg/r_bin.pc pkgcfg/r_anal.pc pkgcfg/r_hash.pc pkgcfg/r_cons.pc pkgcfg/r_diff.pc pkgcfg/r_core.pc pkgcfg/r_lang.pc pkgcfg/r_socket.pc pkgcfg/r_debug.pc pkgcfg/r_reg.pc pkgcfg/r_cmd.pc pkgcfg/r_config.pc pkgcfg/r_flags.pc pkgcfg/r_syscall.pc pkgcfg/r_sign.pc pkgcfg/r_util.pc pkgcfg/r_search.pc pkgcfg/r_bp.pc pkgcfg/r_lib.pc pkgcfg/r_parse.pc pkgcfg/r_fs.pc ; do # SUBDIRS
if [ -f "${VPATH}/${A}.acr" ]; then
SD_TARGET=${A}
else

View File

@ -143,6 +143,5 @@ SUBDIRS ./config-user.mk
pkgcfg/r_bp.pc
pkgcfg/r_lib.pc
pkgcfg/r_parse.pc
pkgcfg/r_print.pc
pkgcfg/r_fs.pc
;

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2011-2012 pancake */
/* radare - LGPL - Copyright 2011-2013 - pancake */
#include <r_types.h>
#include <r_util.h>
@ -113,11 +113,14 @@ static RList* methods (RBinArch *arch) {
return NULL;
ret->free = free;
for (i = 0; i<bin->header.method_size; i++) {
int idx = bin->methods[i].name_id;
if (!(ptr = R_NEW (RBinSymbol)))
break;
r_buf_read_at (bin->b, bin->strings[bin->methods[i].name_id], (ut8*)&buf, 6);
if (idx >= bin->header.strings_size) // workaround
continue;
r_buf_read_at (bin->b, bin->strings[idx], (ut8*)&buf, 6);
len = dex_read_uleb128 (buf);
if (len<1) continue;
name = malloc (len);
if (!name) {
eprintf ("error malloc string length %d\n", len);
@ -138,9 +141,12 @@ static RList* methods (RBinArch *arch) {
}
j = i;
for (i = 0; i<bin->header.fields_size; i++) {
int idx = bin->fields[i].name_id;
if (!(ptr = R_NEW (RBinSymbol)))
break;
r_buf_read_at (bin->b, bin->strings[bin->fields[i].name_id], (ut8*)&buf, 6);
if (idx >= bin->header.strings_size) // workaround
continue;
r_buf_read_at (bin->b, bin->strings[idx], (ut8*)&buf, 6);
len = dex_read_uleb128 (buf);
name = malloc (len);

View File

@ -864,6 +864,8 @@ static int cmd_anal(void *data, const char *input) {
" ah? # show this help\n"
" ah? offset # show hint of given offset\n"
" ah # list hints in human-readable format\n"
" ah- # remove all hints\n"
" ah- offset # remove hints at given offset\n"
" ah* offset # list hints in radare commands format\n"
" aha ppc 51 # set arch for a range of N bytes\n"
" ahb 16 @ $$ # force 16bit for current instruction\n"

View File

@ -57,7 +57,7 @@ R_API int r_core_print_disasm(RPrint *p, RCore *core, ut64 addr, ut8 *buf, int l
int oplen = 0;
int tries = 3;
//r_cons_printf ("len =%d l=%d ib=%d limit=%d\n", len, l, invbreak, p->limit);
//r_cons_printf ("len =%d l=%d ib=%d limit=%d\n", len, l, invbreak, p->limit);
// TODO: import values from debugger is possible
// TODO: allow to get those register snapshots from traces
// TODO: per-function register state trace

View File

@ -845,6 +845,7 @@ R_API int r_anal_fcn_xref_del (RAnal *anal, RAnalFunction *fcn, ut64 at, ut64 ad
/* hints */
//R_API void r_anal_hint_list (RAnal *anal, int mode);
R_API void r_anal_hint_del (RAnal *anal, ut64 addr);
R_API void r_anal_hint_clear (RAnal *a);
R_API RAnalHint *r_anal_hint_at (RAnal *a, ut64 from, int size);
R_API RAnalHint *r_anal_hint_add (RAnal *a, ut64 from, int size);
R_API void r_anal_hint_free (RAnalHint *h);

View File

@ -7,5 +7,5 @@ Name: r_core
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_core -lr_config -lr_cons -lr_io -lr_cmd -lr_util -lr_print -lr_flags -lr_asm -lr_lib -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_print -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_sign -lr_diff -lr_socket -lr_fs @LIBMAGIC@ -lr_db
Libs: -L${libdir} -lr_core -lr_config -lr_cons -lr_io -lr_cmd -lr_util -lr_flags -lr_asm -lr_lib -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_sign -lr_diff -lr_socket -lr_fs @LIBMAGIC@ -lr_db
Cflags: -I${includedir}/libr

View File

@ -1,11 +0,0 @@
prefix=@PREFIX@
exec_prefix=${prefix}
libdir=@LIBDIR@
includedir=${prefix}/include
Name: r_print
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_print -lr_cons -lr_util -lr_asm -lr_anal
Cflags: -I${includedir}/libr