Mercurial > vim
comparison src/mark.c @ 9313:c0760b25f31d v7.4.1939
commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 15 21:44:51 2016 +0200
patch 7.4.1939
Problem: Memory access error when reading viminfo. (Dominique Pelle)
Solution: Correct index in jumplist when at the end.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 15 Jun 2016 21:45:05 +0200 |
parents | 7a6f64de57d5 |
children | f2e534fdbe65 |
comparison
equal
deleted
inserted
replaced
9312:96b65a1b7964 | 9313:c0760b25f31d |
---|---|
1523 break; | 1523 break; |
1524 } | 1524 } |
1525 if (idx < 0 && curwin->w_jumplistlen < JUMPLISTSIZE) | 1525 if (idx < 0 && curwin->w_jumplistlen < JUMPLISTSIZE) |
1526 /* insert as the oldest entry */ | 1526 /* insert as the oldest entry */ |
1527 idx = 0; | 1527 idx = 0; |
1528 else if (idx == 0 && curwin->w_jumplistlen == JUMPLISTSIZE) | |
1529 /* no space to insert as the oldest entry */ | |
1530 idx = -1; | |
1528 } | 1531 } |
1529 else if (curwin->w_jumplistlen < JUMPLISTSIZE) | 1532 else if (curwin->w_jumplistlen < JUMPLISTSIZE) |
1530 /* insert as oldest entry */ | 1533 /* insert as oldest entry */ |
1531 idx = 0; | 1534 idx = 0; |
1532 else | 1535 else |
1535 if (idx >= 0) | 1538 if (idx >= 0) |
1536 { | 1539 { |
1537 if (curwin->w_jumplistlen == JUMPLISTSIZE) | 1540 if (curwin->w_jumplistlen == JUMPLISTSIZE) |
1538 { | 1541 { |
1539 /* Drop the oldest entry. */ | 1542 /* Drop the oldest entry. */ |
1543 --idx; | |
1540 vim_free(curwin->w_jumplist[0].fname); | 1544 vim_free(curwin->w_jumplist[0].fname); |
1541 for (i = 0; i < idx; ++i) | 1545 for (i = 0; i < idx; ++i) |
1542 curwin->w_jumplist[i] = curwin->w_jumplist[i + 1]; | 1546 curwin->w_jumplist[i] = curwin->w_jumplist[i + 1]; |
1543 } | 1547 } |
1544 else | 1548 else |