summaryrefslogtreecommitdiffstats
path: root/src/mark.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-06-15 21:44:51 +0200
committerBram Moolenaar <Bram@vim.org>2016-06-15 21:44:51 +0200
commit28607ba2b82668503f8406bc13690d59af46deb3 (patch)
treebcaccb61eded1a03cda2c8d14bc04f9ca3173a1c /src/mark.c
parent36f0f0686ca313ef7b76387378cd5dc7acea1924 (diff)
patch 7.4.1939v7.4.1939
Problem: Memory access error when reading viminfo. (Dominique Pelle) Solution: Correct index in jumplist when at the end.
Diffstat (limited to 'src/mark.c')
-rw-r--r--src/mark.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mark.c b/src/mark.c
index 5e2ac55071..72a9a923c3 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -1525,6 +1525,9 @@ handle_viminfo_mark(garray_T *values, int force)
if (idx < 0 && curwin->w_jumplistlen < JUMPLISTSIZE)
/* insert as the oldest entry */
idx = 0;
+ else if (idx == 0 && curwin->w_jumplistlen == JUMPLISTSIZE)
+ /* no space to insert as the oldest entry */
+ idx = -1;
}
else if (curwin->w_jumplistlen < JUMPLISTSIZE)
/* insert as oldest entry */
@@ -1537,6 +1540,7 @@ handle_viminfo_mark(garray_T *values, int force)
if (curwin->w_jumplistlen == JUMPLISTSIZE)
{
/* Drop the oldest entry. */
+ --idx;
vim_free(curwin->w_jumplist[0].fname);
for (i = 0; i < idx; ++i)
curwin->w_jumplist[i] = curwin->w_jumplist[i + 1];