0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.1.0968: crash when using search pattern \%Ufffffc23

Problem:    Crash when using search pattern \%Ufffffc23.
Solution:   Limit character to INT_MAX. (closes #4009)
This commit is contained in:
Bram Moolenaar
2019-02-21 22:28:51 +01:00
parent 1417031cfd
commit 527a2d86fb
3 changed files with 12 additions and 1 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -779,6 +779,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
968,
/**/
967,
/**/