|
Karsten Hopp |
59db68 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
59db68 |
Subject: Patch 7.3.155
|
|
Karsten Hopp |
59db68 |
Fcc: outbox
|
|
Karsten Hopp |
59db68 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
59db68 |
Mime-Version: 1.0
|
|
Karsten Hopp |
59db68 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
59db68 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
59db68 |
------------
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
Patch 7.3.155
|
|
Karsten Hopp |
59db68 |
Problem: Crash when using map(), filter() and remove() on v:. (ZyX)
|
|
Karsten Hopp |
59db68 |
Also for extend(). (Yukihiro Nakadaira)
|
|
Karsten Hopp |
59db68 |
Solution: Mark v: as locked. Also correct locking error messages.
|
|
Karsten Hopp |
59db68 |
Files: src/eval.c
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
*** ../vim-7.3.154/src/eval.c 2011-04-01 16:07:41.000000000 +0200
|
|
Karsten Hopp |
59db68 |
--- src/eval.c 2011-04-11 13:28:34.000000000 +0200
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 853,858 ****
|
|
Karsten Hopp |
59db68 |
--- 853,859 ----
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
init_var_dict(&globvardict, &globvars_var);
|
|
Karsten Hopp |
59db68 |
init_var_dict(&vimvardict, &vimvars_var);
|
|
Karsten Hopp |
59db68 |
+ vimvardict.dv_lock = VAR_FIXED;
|
|
Karsten Hopp |
59db68 |
hash_init(&compat_hashtab);
|
|
Karsten Hopp |
59db68 |
hash_init(&func_hashtab);
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 8545,8551 ****
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type == VAR_LIST)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if ((l = argvars[0].vval.v_list) != NULL
|
|
Karsten Hopp |
59db68 |
! && !tv_check_lock(l->lv_lock, (char_u *)"add()")
|
|
Karsten Hopp |
59db68 |
&& list_append_tv(l, &argvars[1]) == OK)
|
|
Karsten Hopp |
59db68 |
copy_tv(&argvars[0], rettv);
|
|
Karsten Hopp |
59db68 |
}
|
|
Karsten Hopp |
59db68 |
--- 8546,8552 ----
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type == VAR_LIST)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if ((l = argvars[0].vval.v_list) != NULL
|
|
Karsten Hopp |
59db68 |
! && !tv_check_lock(l->lv_lock, (char_u *)_("add() argument"))
|
|
Karsten Hopp |
59db68 |
&& list_append_tv(l, &argvars[1]) == OK)
|
|
Karsten Hopp |
59db68 |
copy_tv(&argvars[0], rettv);
|
|
Karsten Hopp |
59db68 |
}
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 9946,9951 ****
|
|
Karsten Hopp |
59db68 |
--- 9947,9954 ----
|
|
Karsten Hopp |
59db68 |
typval_T *argvars;
|
|
Karsten Hopp |
59db68 |
typval_T *rettv;
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
+ char *arg_errmsg = N_("extend() argument");
|
|
Karsten Hopp |
59db68 |
+
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_LIST)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
list_T *l1, *l2;
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 9955,9961 ****
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
l1 = argvars[0].vval.v_list;
|
|
Karsten Hopp |
59db68 |
l2 = argvars[1].vval.v_list;
|
|
Karsten Hopp |
59db68 |
! if (l1 != NULL && !tv_check_lock(l1->lv_lock, (char_u *)"extend()")
|
|
Karsten Hopp |
59db68 |
&& l2 != NULL)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if (argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
59db68 |
--- 9958,9964 ----
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
l1 = argvars[0].vval.v_list;
|
|
Karsten Hopp |
59db68 |
l2 = argvars[1].vval.v_list;
|
|
Karsten Hopp |
59db68 |
! if (l1 != NULL && !tv_check_lock(l1->lv_lock, (char_u *)_(arg_errmsg))
|
|
Karsten Hopp |
59db68 |
&& l2 != NULL)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if (argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 9994,10000 ****
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
d1 = argvars[0].vval.v_dict;
|
|
Karsten Hopp |
59db68 |
d2 = argvars[1].vval.v_dict;
|
|
Karsten Hopp |
59db68 |
! if (d1 != NULL && !tv_check_lock(d1->dv_lock, (char_u *)"extend()")
|
|
Karsten Hopp |
59db68 |
&& d2 != NULL)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
/* Check the third argument. */
|
|
Karsten Hopp |
59db68 |
--- 9997,10003 ----
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
d1 = argvars[0].vval.v_dict;
|
|
Karsten Hopp |
59db68 |
d2 = argvars[1].vval.v_dict;
|
|
Karsten Hopp |
59db68 |
! if (d1 != NULL && !tv_check_lock(d1->dv_lock, (char_u *)_(arg_errmsg))
|
|
Karsten Hopp |
59db68 |
&& d2 != NULL)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
/* Check the third argument. */
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 10236,10255 ****
|
|
Karsten Hopp |
59db68 |
typval_T save_key;
|
|
Karsten Hopp |
59db68 |
int rem;
|
|
Karsten Hopp |
59db68 |
int todo;
|
|
Karsten Hopp |
59db68 |
! char_u *ermsg = map ? (char_u *)"map()" : (char_u *)"filter()";
|
|
Karsten Hopp |
59db68 |
int save_did_emsg;
|
|
Karsten Hopp |
59db68 |
int idx = 0;
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type == VAR_LIST)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if ((l = argvars[0].vval.v_list) == NULL
|
|
Karsten Hopp |
59db68 |
! || (map && tv_check_lock(l->lv_lock, ermsg)))
|
|
Karsten Hopp |
59db68 |
return;
|
|
Karsten Hopp |
59db68 |
}
|
|
Karsten Hopp |
59db68 |
else if (argvars[0].v_type == VAR_DICT)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if ((d = argvars[0].vval.v_dict) == NULL
|
|
Karsten Hopp |
59db68 |
! || (map && tv_check_lock(d->dv_lock, ermsg)))
|
|
Karsten Hopp |
59db68 |
return;
|
|
Karsten Hopp |
59db68 |
}
|
|
Karsten Hopp |
59db68 |
else
|
|
Karsten Hopp |
59db68 |
--- 10239,10260 ----
|
|
Karsten Hopp |
59db68 |
typval_T save_key;
|
|
Karsten Hopp |
59db68 |
int rem;
|
|
Karsten Hopp |
59db68 |
int todo;
|
|
Karsten Hopp |
59db68 |
! char_u *ermsg = (char_u *)(map ? "map()" : "filter()");
|
|
Karsten Hopp |
59db68 |
! char *arg_errmsg = (map ? N_("map() argument")
|
|
Karsten Hopp |
59db68 |
! : N_("filter() argument"));
|
|
Karsten Hopp |
59db68 |
int save_did_emsg;
|
|
Karsten Hopp |
59db68 |
int idx = 0;
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type == VAR_LIST)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if ((l = argvars[0].vval.v_list) == NULL
|
|
Karsten Hopp |
59db68 |
! || tv_check_lock(l->lv_lock, (char_u *)_(arg_errmsg)))
|
|
Karsten Hopp |
59db68 |
return;
|
|
Karsten Hopp |
59db68 |
}
|
|
Karsten Hopp |
59db68 |
else if (argvars[0].v_type == VAR_DICT)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if ((d = argvars[0].vval.v_dict) == NULL
|
|
Karsten Hopp |
59db68 |
! || tv_check_lock(d->dv_lock, (char_u *)_(arg_errmsg)))
|
|
Karsten Hopp |
59db68 |
return;
|
|
Karsten Hopp |
59db68 |
}
|
|
Karsten Hopp |
59db68 |
else
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 10286,10292 ****
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
--todo;
|
|
Karsten Hopp |
59db68 |
di = HI2DI(hi);
|
|
Karsten Hopp |
59db68 |
! if (tv_check_lock(di->di_tv.v_lock, ermsg))
|
|
Karsten Hopp |
59db68 |
break;
|
|
Karsten Hopp |
59db68 |
vimvars[VV_KEY].vv_str = vim_strsave(di->di_key);
|
|
Karsten Hopp |
59db68 |
if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL
|
|
Karsten Hopp |
59db68 |
--- 10291,10298 ----
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
--todo;
|
|
Karsten Hopp |
59db68 |
di = HI2DI(hi);
|
|
Karsten Hopp |
59db68 |
! if (tv_check_lock(di->di_tv.v_lock,
|
|
Karsten Hopp |
59db68 |
! (char_u *)_(arg_errmsg)))
|
|
Karsten Hopp |
59db68 |
break;
|
|
Karsten Hopp |
59db68 |
vimvars[VV_KEY].vv_str = vim_strsave(di->di_key);
|
|
Karsten Hopp |
59db68 |
if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 10305,10311 ****
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
for (li = l->lv_first; li != NULL; li = nli)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
! if (tv_check_lock(li->li_tv.v_lock, ermsg))
|
|
Karsten Hopp |
59db68 |
break;
|
|
Karsten Hopp |
59db68 |
nli = li->li_next;
|
|
Karsten Hopp |
59db68 |
vimvars[VV_KEY].vv_nr = idx;
|
|
Karsten Hopp |
59db68 |
--- 10311,10317 ----
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
for (li = l->lv_first; li != NULL; li = nli)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
! if (tv_check_lock(li->li_tv.v_lock, (char_u *)_(arg_errmsg)))
|
|
Karsten Hopp |
59db68 |
break;
|
|
Karsten Hopp |
59db68 |
nli = li->li_next;
|
|
Karsten Hopp |
59db68 |
vimvars[VV_KEY].vv_nr = idx;
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 12910,12916 ****
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type != VAR_LIST)
|
|
Karsten Hopp |
59db68 |
EMSG2(_(e_listarg), "insert()");
|
|
Karsten Hopp |
59db68 |
else if ((l = argvars[0].vval.v_list) != NULL
|
|
Karsten Hopp |
59db68 |
! && !tv_check_lock(l->lv_lock, (char_u *)"insert()"))
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if (argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
59db68 |
before = get_tv_number_chk(&argvars[2], &error);
|
|
Karsten Hopp |
59db68 |
--- 12916,12922 ----
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type != VAR_LIST)
|
|
Karsten Hopp |
59db68 |
EMSG2(_(e_listarg), "insert()");
|
|
Karsten Hopp |
59db68 |
else if ((l = argvars[0].vval.v_list) != NULL
|
|
Karsten Hopp |
59db68 |
! && !tv_check_lock(l->lv_lock, (char_u *)_("insert() argument")))
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if (argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
59db68 |
before = get_tv_number_chk(&argvars[2], &error);
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 14775,14787 ****
|
|
Karsten Hopp |
59db68 |
char_u *key;
|
|
Karsten Hopp |
59db68 |
dict_T *d;
|
|
Karsten Hopp |
59db68 |
dictitem_T *di;
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type == VAR_DICT)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if (argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
59db68 |
EMSG2(_(e_toomanyarg), "remove()");
|
|
Karsten Hopp |
59db68 |
else if ((d = argvars[0].vval.v_dict) != NULL
|
|
Karsten Hopp |
59db68 |
! && !tv_check_lock(d->dv_lock, (char_u *)"remove() argument"))
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
key = get_tv_string_chk(&argvars[1]);
|
|
Karsten Hopp |
59db68 |
if (key != NULL)
|
|
Karsten Hopp |
59db68 |
--- 14781,14794 ----
|
|
Karsten Hopp |
59db68 |
char_u *key;
|
|
Karsten Hopp |
59db68 |
dict_T *d;
|
|
Karsten Hopp |
59db68 |
dictitem_T *di;
|
|
Karsten Hopp |
59db68 |
+ char *arg_errmsg = N_("remove() argument");
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type == VAR_DICT)
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
if (argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
59db68 |
EMSG2(_(e_toomanyarg), "remove()");
|
|
Karsten Hopp |
59db68 |
else if ((d = argvars[0].vval.v_dict) != NULL
|
|
Karsten Hopp |
59db68 |
! && !tv_check_lock(d->dv_lock, (char_u *)_(arg_errmsg)))
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
key = get_tv_string_chk(&argvars[1]);
|
|
Karsten Hopp |
59db68 |
if (key != NULL)
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 14801,14807 ****
|
|
Karsten Hopp |
59db68 |
else if (argvars[0].v_type != VAR_LIST)
|
|
Karsten Hopp |
59db68 |
EMSG2(_(e_listdictarg), "remove()");
|
|
Karsten Hopp |
59db68 |
else if ((l = argvars[0].vval.v_list) != NULL
|
|
Karsten Hopp |
59db68 |
! && !tv_check_lock(l->lv_lock, (char_u *)"remove() argument"))
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
int error = FALSE;
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
--- 14808,14814 ----
|
|
Karsten Hopp |
59db68 |
else if (argvars[0].v_type != VAR_LIST)
|
|
Karsten Hopp |
59db68 |
EMSG2(_(e_listdictarg), "remove()");
|
|
Karsten Hopp |
59db68 |
else if ((l = argvars[0].vval.v_list) != NULL
|
|
Karsten Hopp |
59db68 |
! && !tv_check_lock(l->lv_lock, (char_u *)_(arg_errmsg)))
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
int error = FALSE;
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 15135,15141 ****
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type != VAR_LIST)
|
|
Karsten Hopp |
59db68 |
EMSG2(_(e_listarg), "reverse()");
|
|
Karsten Hopp |
59db68 |
else if ((l = argvars[0].vval.v_list) != NULL
|
|
Karsten Hopp |
59db68 |
! && !tv_check_lock(l->lv_lock, (char_u *)"reverse()"))
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
li = l->lv_last;
|
|
Karsten Hopp |
59db68 |
l->lv_first = l->lv_last = NULL;
|
|
Karsten Hopp |
59db68 |
--- 15142,15148 ----
|
|
Karsten Hopp |
59db68 |
if (argvars[0].v_type != VAR_LIST)
|
|
Karsten Hopp |
59db68 |
EMSG2(_(e_listarg), "reverse()");
|
|
Karsten Hopp |
59db68 |
else if ((l = argvars[0].vval.v_list) != NULL
|
|
Karsten Hopp |
59db68 |
! && !tv_check_lock(l->lv_lock, (char_u *)_("reverse() argument")))
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
li = l->lv_last;
|
|
Karsten Hopp |
59db68 |
l->lv_first = l->lv_last = NULL;
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 16432,16438 ****
|
|
Karsten Hopp |
59db68 |
else
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
l = argvars[0].vval.v_list;
|
|
Karsten Hopp |
59db68 |
! if (l == NULL || tv_check_lock(l->lv_lock, (char_u *)"sort()"))
|
|
Karsten Hopp |
59db68 |
return;
|
|
Karsten Hopp |
59db68 |
rettv->vval.v_list = l;
|
|
Karsten Hopp |
59db68 |
rettv->v_type = VAR_LIST;
|
|
Karsten Hopp |
59db68 |
--- 16439,16446 ----
|
|
Karsten Hopp |
59db68 |
else
|
|
Karsten Hopp |
59db68 |
{
|
|
Karsten Hopp |
59db68 |
l = argvars[0].vval.v_list;
|
|
Karsten Hopp |
59db68 |
! if (l == NULL || tv_check_lock(l->lv_lock,
|
|
Karsten Hopp |
59db68 |
! (char_u *)_("sort() argument")))
|
|
Karsten Hopp |
59db68 |
return;
|
|
Karsten Hopp |
59db68 |
rettv->vval.v_list = l;
|
|
Karsten Hopp |
59db68 |
rettv->v_type = VAR_LIST;
|
|
Karsten Hopp |
59db68 |
*** ../vim-7.3.154/src/version.c 2011-04-02 15:12:45.000000000 +0200
|
|
Karsten Hopp |
59db68 |
--- src/version.c 2011-04-11 13:13:38.000000000 +0200
|
|
Karsten Hopp |
59db68 |
***************
|
|
Karsten Hopp |
59db68 |
*** 716,717 ****
|
|
Karsten Hopp |
59db68 |
--- 716,719 ----
|
|
Karsten Hopp |
59db68 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
59db68 |
+ /**/
|
|
Karsten Hopp |
59db68 |
+ 155,
|
|
Karsten Hopp |
59db68 |
/**/
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
--
|
|
Karsten Hopp |
59db68 |
I used to be indecisive, now I'm not sure.
|
|
Karsten Hopp |
59db68 |
|
|
Karsten Hopp |
59db68 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
59db68 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
59db68 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
59db68 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|