diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-10-27 00:57:05 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-10-27 00:57:05 +0200 |
commit | ee03b941241eae1d36bc29b84eec09116cefe7cd (patch) | |
tree | ac93a13476ae91cb297aea0af44c4f4bb4b9888e /src | |
parent | cf1ba35fc2ebd41b9a7738bbd1f026f5311560aa (diff) | |
download | vim-ee03b941241eae1d36bc29b84eec09116cefe7cd.zip |
patch 8.0.1225: no check for spell region being zero
Problem: No check for spell region being zero. (geeknik)
Solution: Check for zero. (closes #2252)
Diffstat (limited to 'src')
-rw-r--r-- | src/spellfile.c | 2 | ||||
-rw-r--r-- | src/testdir/test_spell.vim | 9 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/spellfile.c b/src/spellfile.c index 6188aaf40..f6d7a6432 100644 --- a/src/spellfile.c +++ b/src/spellfile.c @@ -4277,7 +4277,7 @@ spell_read_wordfile(spellinfo_T *spin, char_u *fname) flags |= WF_REGION; l = *p - '0'; - if (l > spin->si_region_count) + if (l == 0 || l > spin->si_region_count) { smsg((char_u *)_("Invalid region nr in %s line %d: %s"), fname, lnum, p); diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim index e4c236c96..54209fec7 100644 --- a/src/testdir/test_spell.vim +++ b/src/testdir/test_spell.vim @@ -271,6 +271,15 @@ func Test_zz_sal_and_addition() call assert_equal("elekwint", SecondSpellWord()) endfunc +func Test_region_error() + messages clear + call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add") + mkspell! Xtest.latin1.add.spl Xtest.latin1.add + call assert_match('Invalid region nr in Xtest.latin1.add line 2: 0', execute('messages')) + call delete('Xtest.latin1.add') + call delete('Xtest.latin1.add.spl') +endfunc + " Check using z= in new buffer (crash fixed by patch 7.4a.028). func Test_zeq_crash() new diff --git a/src/version.c b/src/version.c index 2b8fda7f3..6ab4e7546 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1225, +/**/ 1224, /**/ 1223, |