To: vim_dev@googlegroups.com Subject: Patch 8.2.3494 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3494 Problem: Illegal memory access in utf_head_off. Solution: Check cursor position when reselecting the Visual area. (closes #8963) Files: src/normal.c, src/testdir/test_visual.vim *** ../vim-8.2.3493/src/normal.c 2021-09-12 12:39:04.323467415 +0100 --- src/normal.c 2021-10-11 15:38:10.609650473 +0100 *************** *** 5671,5678 **** { curwin->w_cursor.lnum += resel_VIsual_line_count * cap->count0 - 1; ! if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) ! curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; } VIsual_mode = resel_VIsual_mode; if (VIsual_mode == 'v') --- 5671,5677 ---- { curwin->w_cursor.lnum += resel_VIsual_line_count * cap->count0 - 1; ! check_cursor(); } VIsual_mode = resel_VIsual_mode; if (VIsual_mode == 'v') *** ../vim-8.2.3493/src/testdir/test_visual.vim 2021-07-04 11:30:00.215304320 +0100 --- src/testdir/test_visual.vim 2021-10-11 15:36:03.998999040 +0100 *************** *** 1265,1269 **** --- 1265,1289 ---- call delete('XTest_block') endfunc + func Test_visual_reselect_with_count() + " this was causing an illegal memory access + let lines =<< trim END + + + + : + r + exe "%norm e3\kr\t" + : + + : + END + call writefile(lines, 'XvisualReselect') + source XvisualReselect + + bwipe! + call delete('XvisualReselect') + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.3493/src/version.c 2021-10-10 13:53:55.345494414 +0100 --- src/version.c 2021-10-11 15:39:27.987201847 +0100 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3494, /**/ -- hundred-and-one symptoms of being an internet addict: 131. You challenge authority and society by portnuking people /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///