diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 333c006f48..ba75834fc5 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -1475,7 +1475,7 @@ nfa_regatom(void) default: nr = -1; break; } - if (nr < 0) + if (nr < 0 || nr > INT_MAX) EMSG2_RET_FAIL( _("E678: Invalid character after %s%%[dxouU]"), reg_magic == MAGIC_ALL); diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim index 972144aca1..4ff2aca5ac 100644 --- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -1211,3 +1211,12 @@ func Test_search_Ctrl_L_combining() call assert_equal(bufcontent[1], @/) call Incsearch_cleanup() endfunc + +func Test_large_hex_chars() + " This used to cause a crash, the character becomes an NFA state. + try + /\%Ufffffc23 + catch + call assert_match('E678:', v:exception) + endtry +endfunc diff --git a/src/version.c b/src/version.c index 825c5e54be..13f54e343d 100644 --- a/src/version.c +++ b/src/version.c @@ -779,6 +779,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 968, /**/ 967, /**/