To: vim_dev@googlegroups.com Subject: Patch 9.0.0240 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0240 Problem: Crash when using ":mkspell" with an empty .dic file. Solution: Check for an empty word tree. Files: src/spellfile.c, src/testdir/test_spellfile.vim *** ../vim-9.0.0239/src/spellfile.c 2022-08-14 14:16:07.999582175 +0100 --- src/spellfile.c 2022-08-21 20:29:53.806129274 +0100 *************** *** 5585,5594 **** /* * Go through the whole case-folded tree, soundfold each word and put it ! * in the trie. */ byts = slang->sl_fbyts; idxs = slang->sl_fidxs; arridx[0] = 0; curi[0] = 1; --- 5585,5596 ---- /* * Go through the whole case-folded tree, soundfold each word and put it ! * in the trie. Bail out if the tree is empty. */ byts = slang->sl_fbyts; idxs = slang->sl_fidxs; + if (byts == NULL || idxs == NULL) + return FAIL; arridx[0] = 0; curi[0] = 1; *** ../vim-9.0.0239/src/testdir/test_spellfile.vim 2022-08-04 13:01:44.769330917 +0100 --- src/testdir/test_spellfile.vim 2022-08-21 20:31:30.725960894 +0100 *************** *** 1168,1171 **** --- 1168,1183 ---- delete('Xtest', 'rf') enddef + " this was using a NULL pointer + func Test_mkspell_empty_dic() + call writefile(['1'], 'XtestEmpty.dic') + call writefile(['SOFOFROM abcd', 'SOFOTO ABCD', 'SAL CIA X'], 'XtestEmpty.aff') + mkspell! XtestEmpty.spl XtestEmpty + + call delete('XtestEmpty.dic') + call delete('XtestEmpty.aff') + call delete('XtestEmpty.spl') + endfunc + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.0239/src/version.c 2022-08-21 19:08:47.078217067 +0100 --- src/version.c 2022-08-21 20:28:28.794266101 +0100 *************** *** 733,734 **** --- 733,736 ---- { /* Add new patch number below this line */ + /**/ + 240, /**/ -- Q: How do you tell the difference between a female cat and a male cat? A: You ask it a question and if HE answers, it's a male but, if SHE answers, it's a female. /// 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 ///