Mercurial > vim
changeset 3508:02440d1fcc9a v7.3.516
updated for version 7.3.516
Problem: extend(o, o) may crash Vim.
Solution: Fix crash and add test. (Thinca and Hirohito Higashi)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 18 May 2012 12:07:05 +0200 |
parents | 8201108e9cf0 |
children | 5598c71c06a0 |
files | src/eval.c src/testdir/test55.in src/testdir/test55.ok src/version.c |
diffstat | 4 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -10191,7 +10191,7 @@ f_extend(argvars, rettv) EMSG2(_("E737: Key already exists: %s"), hi2->hi_key); break; } - else if (*action == 'f') + else if (*action == 'f' && HI2DI(hi2) != di1) { clear_tv(&di1->di_tv); copy_tv(&HI2DI(hi2)->di_tv, &di1->di_tv);
--- a/src/testdir/test55.in +++ b/src/testdir/test55.in @@ -352,6 +352,24 @@ let l = [0, 1, 2, 3] :let dict4copy = deepcopy(dict4) :$put =(l == lcopy) :$put =(dict4 == dict4copy) +:" +:" Pass the same List to extend() +:let l = [1, 2, 3, 4, 5] +:call extend(l, l) +:$put =string(l) +:" +:" Pass the same Dict to extend() +:let d = { 'a': {'b': 'B'}} +:call extend(d, d) +:$put =string(d) +:" +:" Pass the same Dict to extend() with "error" +:try +: call extend(d, d, "error") +:catch +: $put =v:exception[:15] . v:exception[-1:-1] +:endtry +:$put =string(d) :endfun :" :call Test(1, 2, [3, 4], {5: 6}) " This may take a while