summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2012-05-18 12:07:05 +0200
committerBram Moolenaar <bram@vim.org>2012-05-18 12:07:05 +0200
commit25ec33b1731abfad80fc9a728bf3c3fa26927eaa (patch)
treeb25825bbcf577d16eeea4e088fba7c72577d2b48
parentda9a6d9c924e83238d09496002da0b264b3d542a (diff)
downloadvim-7-3-516.tar.gz
updated for version 7.3.516v7.3.516v7-3-516
Problem: extend(o, o) may crash Vim. Solution: Fix crash and add test. (Thinca and Hirohito Higashi)
-rw-r--r--src/eval.c2
-rw-r--r--src/testdir/test55.in18
-rw-r--r--src/testdir/test55.ok4
-rw-r--r--src/version.c2
4 files changed, 25 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c
index fa9966e7..9a81b4f2 100644
--- 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);
diff --git a/src/testdir/test55.in b/src/testdir/test55.in
index 0cac3486..cf85f57a 100644
--- 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
diff --git a/src/testdir/test55.ok b/src/testdir/test55.ok
index 6e402354..fde085ce 100644
--- a/src/testdir/test55.ok
+++ b/src/testdir/test55.ok
@@ -111,3 +111,7 @@ caught a:000[3]
0
1
1
+[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
+{'a': {'b': 'B'}}
+Vim(call):E737: a
+{'a': {'b': 'B'}}
diff --git a/src/version.c b/src/version.c
index 317a2d19..5b4bbfc3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 516,
+/**/
515,
/**/
514,