* Add patch from @capi_x fixing segfault when refering an invalid fun var

* Do not override RANLIB with mingw one by default
This commit is contained in:
pancake 2011-03-10 14:14:22 +01:00
parent 7df412ae25
commit 7dd8619477
3 changed files with 27 additions and 17 deletions

View File

@ -147,10 +147,12 @@ R_API int r_anal_var_del(RAnal *anal, RAnalFcn *fcn, int delta, int type) {
R_API RAnalVar *r_anal_var_get(RAnal *anal, RAnalFcn *fcn, int delta, int type) {
RAnalVar *vari;
RListIter *iter;
r_list_foreach (fcn->vars, iter, vari)
if ((type==-1||vari->type == type) && vari->delta == delta)
return vari;
return NULL;
r_list_foreach (fcn->vars, iter, vari)
if ((type==-1||vari->type == type) && vari->delta == delta)
return vari;
return NULL;
}
// XXX: rename function type? i think this is 'scope'
@ -171,15 +173,18 @@ R_API const char *r_anal_var_type_to_str (RAnal *anal, int type) {
R_API int r_anal_var_access_add(RAnal *anal, RAnalVar *var, ut64 from, int set) {
RAnalVarAccess *acc, *acci;
RListIter *iter;
r_list_foreach(var->accesses, iter, acci)
if (acci->addr == from)
return R_TRUE;
if (!(acc = r_anal_var_access_new ()))
return R_FALSE;
acc->addr = from;
acc->set = set;
r_list_append (var->accesses, acc);
return R_TRUE;
r_list_foreach(var->accesses, iter, acci)
if (acci->addr == from)
return R_TRUE;
if (!(acc = r_anal_var_access_new ()))
return R_FALSE;
acc->addr = from;
acc->set = set;
r_list_append (var->accesses, acc);
return R_TRUE;
}
R_API int r_anal_var_access_del(RAnal *anal, RAnalVar *var, ut64 from) {

View File

@ -2314,8 +2314,13 @@ static int var_cmd(RCore *core, const char *str) {
case 's':
case 'g':
if (str[2]!='\0') {
RAnalVar *var = r_anal_var_get (core->anal, fcn, atoi (str+2), R_ANAL_VAR_TYPE_LOCAL);
return r_anal_var_access_add (core->anal, var, atoi (str+2), (str[1]=='g')?0:1);
if ( fcn != NULL ) {
RAnalVar *var = r_anal_var_get (core->anal, fcn, atoi (str+2), R_ANAL_VAR_TYPE_LOCAL);
return r_anal_var_access_add (core->anal, var, atoi (str+2), (str[1]=='g')?0:1);
} else {
eprintf("Unknown variable in: '%s'\n", str);
return R_FALSE;
}
}
break;
}

View File

@ -1,7 +1,7 @@
include ../../../config.mk
CC?=i486-mingw32-gcc
RANLIB?=i486-mingw32-ranlib
CC?=gcc
RANLIB?=ranlib
#CC?=gcc
OSTYPE=$(shell uname -s)