To: vim_dev@googlegroups.com Subject: Patch 8.0.1486 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1486 Problem: Accessing invalid memory with "it". (Dominique Pelle) Solution: Avoid going over the end of the line. (Christian Brabandt, closes #2532) Files: src/search.c, src/testdir/test_textobjects.vim *** ../vim-8.0.1485/src/search.c 2018-02-09 16:04:18.614716654 +0100 --- src/search.c 2018-02-09 18:00:00.951118009 +0100 *************** *** 684,694 **** && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count && pos->col < MAXCOL - 2) { ! ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col; ! if (*ptr == NUL) start_char_len = 1; else ! start_char_len = (*mb_ptr2len)(ptr); } #endif else --- 684,694 ---- && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count && pos->col < MAXCOL - 2) { ! ptr = ml_get_buf(buf, pos->lnum, FALSE); ! if ((int)STRLEN(ptr) < pos->col) start_char_len = 1; else ! start_char_len = (*mb_ptr2len)(ptr + pos->col); } #endif else *** ../vim-8.0.1485/src/testdir/test_textobjects.vim 2017-10-15 22:07:35.211683156 +0200 --- src/testdir/test_textobjects.vim 2018-02-09 18:06:35.004448046 +0100 *************** *** 152,154 **** --- 152,167 ---- call assert_equal(3 , match('abc', '\zs', 3, 1)) call assert_equal(-1, match('abc', '\zs', 4, 1)) endfunc + + " This was causing an illegal memory access + func Test_inner_tag() + new + norm ixxx + call feedkeys("v", 'xt') + insert + x + x + . + norm it + q! + endfunc *** ../vim-8.0.1485/src/version.c 2018-02-09 17:50:24.618970387 +0100 --- src/version.c 2018-02-09 17:58:18.015812117 +0100 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1486, /**/ -- Computers are not intelligent. They only think they are. /// 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 ///