mirror of
https://github.com/vim/vim.git
synced 2025-10-04 05:25:06 -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:
@@ -1475,7 +1475,7 @@ nfa_regatom(void)
|
|||||||
default: nr = -1; break;
|
default: nr = -1; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nr < 0)
|
if (nr < 0 || nr > INT_MAX)
|
||||||
EMSG2_RET_FAIL(
|
EMSG2_RET_FAIL(
|
||||||
_("E678: Invalid character after %s%%[dxouU]"),
|
_("E678: Invalid character after %s%%[dxouU]"),
|
||||||
reg_magic == MAGIC_ALL);
|
reg_magic == MAGIC_ALL);
|
||||||
|
@@ -1211,3 +1211,12 @@ func Test_search_Ctrl_L_combining()
|
|||||||
call assert_equal(bufcontent[1], @/)
|
call assert_equal(bufcontent[1], @/)
|
||||||
call Incsearch_cleanup()
|
call Incsearch_cleanup()
|
||||||
endfunc
|
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
|
||||||
|
@@ -779,6 +779,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
968,
|
||||||
/**/
|
/**/
|
||||||
967,
|
967,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user