Skip to content

Commit ee03b94

Browse files
committed
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)
1 parent cf1ba35 commit ee03b94

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/spellfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4277,7 +4277,7 @@ spell_read_wordfile(spellinfo_T *spin, char_u *fname)
42774277
flags |= WF_REGION;
42784278

42794279
l = *p - '0';
4280-
if (l > spin->si_region_count)
4280+
if (l == 0 || l > spin->si_region_count)
42814281
{
42824282
smsg((char_u *)_("Invalid region nr in %s line %d: %s"),
42834283
fname, lnum, p);

src/testdir/test_spell.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,15 @@ func Test_zz_sal_and_addition()
271271
call assert_equal("elekwint", SecondSpellWord())
272272
endfunc
273273

274+
func Test_region_error()
275+
messages clear
276+
call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add")
277+
mkspell! Xtest.latin1.add.spl Xtest.latin1.add
278+
call assert_match('Invalid region nr in Xtest.latin1.add line 2: 0', execute('messages'))
279+
call delete('Xtest.latin1.add')
280+
call delete('Xtest.latin1.add.spl')
281+
endfunc
282+
274283
" Check using z= in new buffer (crash fixed by patch 7.4a.028).
275284
func Test_zeq_crash()
276285
new

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1225,
764766
/**/
765767
1224,
766768
/**/

0 commit comments

Comments
 (0)