To: vim_dev@googlegroups.com Subject: Patch 8.1.1824 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1824 Problem: Crash when correctly spelled word is very long. (Ben Kraft) Solution: Check word length before copying. (closes #4778) Files: src/spell.c, src/testdir/test_spell.vim *** ../vim-8.1.1823/src/spell.c 2019-07-19 23:04:30.683765070 +0200 --- src/spell.c 2019-08-06 22:46:17.728909680 +0200 *************** *** 2073,2078 **** --- 2073,2080 ---- if (len == -1) p = word; + else if (len >= MAXWLEN) + return; else { vim_strncpy(buf, word, len); *** ../vim-8.1.1823/src/testdir/test_spell.vim 2019-06-15 17:57:43.976724009 +0200 --- src/testdir/test_spell.vim 2019-08-06 22:44:30.065170344 +0200 *************** *** 1,4 **** --- 1,5 ---- " Test spell checking + " Note: this file uses latin1 encoding, but is used with utf-8 encoding. source check.vim CheckFeature spell *************** *** 398,403 **** --- 399,416 ---- bwipe! endfunc + " Check handling a word longer than MAXWLEN. + func Test_spell_long_word() + set enc=utf-8 + new + call setline(1, "d\xCC\xB4\xCC\xBD\xCD\x88\xCD\x94a\xCC\xB5\xCD\x84\xCD\x84\xCC\xA8\xCD\x9Cr\xCC\xB5\xCC\x8E\xCD\x85\xCD\x85k\xCC\xB6\xCC\x89\xCC\x9D \xCC\xB6\xCC\x83\xCC\x8F\xCC\xA4\xCD\x8Ef\xCC\xB7\xCC\x81\xCC\x80\xCC\xA9\xCC\xB0\xCC\xAC\xCC\xA2\xCD\x95\xCD\x87\xCD\x8D\xCC\x9E\xCD\x99\xCC\xAD\xCC\xAB\xCC\x97\xCC\xBBo\xCC\xB6\xCC\x84\xCC\x95\xCC\x8C\xCC\x8B\xCD\x9B\xCD\x9C\xCC\xAFr\xCC\xB7\xCC\x94\xCD\x83\xCD\x97\xCC\x8C\xCC\x82\xCD\x82\xCD\x80\xCD\x91\xCC\x80\xCC\xBE\xCC\x82\xCC\x8F\xCC\xA3\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BC\xCC\x99\xCD\x9A\xCC\xB2\xCC\xB1\xCC\x9F\xCC\xBB\xCC\xA6\xCD\x85\xCC\xAA\xCD\x89\xCC\x9D\xCC\x99\xCD\x96\xCC\xB1\xCC\xB1\xCC\x99\xCC\xA6\xCC\xA5\xCD\x95\xCC\xB2\xCC\xA0\xCD\x99 within") + set spell spelllang=en + redraw + redraw! + bwipe! + set nospell + endfunc + func LoadAffAndDic(aff_contents, dic_contents) set enc=latin1 set spellfile= *** ../vim-8.1.1823/src/version.c 2019-08-06 21:59:37.763982481 +0200 --- src/version.c 2019-08-06 22:45:44.976993199 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 1824, /**/ -- One difference between a man and a machine is that a machine is quiet when well oiled. /// 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 ///