To: vim_dev@googlegroups.com Subject: Patch 7.4.1939 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1939 Problem: Memory access error when reading viminfo. (Dominique Pelle) Solution: Correct index in jumplist when at the end. Files: src/mark.c, src/testdir/test_viminfo.vim *** ../vim-7.4.1938/src/mark.c 2016-06-14 23:02:42.432030667 +0200 --- src/mark.c 2016-06-15 21:19:35.177615437 +0200 *************** *** 1525,1530 **** --- 1525,1533 ---- 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,1542 **** --- 1540,1546 ---- 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]; *** ../vim-7.4.1938/src/testdir/test_viminfo.vim 2016-06-13 22:22:10.884157766 +0200 --- src/testdir/test_viminfo.vim 2016-06-15 21:09:02.208383056 +0200 *************** *** 322,327 **** --- 322,328 ---- clearjumps rviminfo Xviminfo + let last_line = line('.') exe "normal \" call assert_equal('time 30', getline('.')) exe "normal \" *************** *** 336,341 **** --- 337,356 ---- exe "normal \" call assert_equal('time 05', getline('.')) + " Test with jumplist full. + clearjumps + call setline(1, repeat(['match here'], 101)) + call cursor(1, 1) + call test_settime(10) + for i in range(100) + exe "normal /here\r" + endfor + rviminfo Xviminfo + + " must be newest mark that comes from viminfo. + exe "normal \" + call assert_equal(last_line, line('.')) + bwipe! call delete('Xviminfo') endfunc *** ../vim-7.4.1938/src/version.c 2016-06-14 23:02:42.432030667 +0200 --- src/version.c 2016-06-15 21:43:21.442316441 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1939, /**/ -- From "know your smileys": C=}>;*{)) Drunk, devilish chef with a toupee in an updraft, a mustache, and a double chin /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///