vim-patch:8.1.0968: crash when using search pattern \%Ufffffc23

Problem:    Crash when using search pattern \%Ufffffc23.
Solution:   Limit character to INT_MAX. (closes vim/vim#4009)
527a2d86fb
This commit is contained in:
Justin M. Keyes
2019-02-28 12:08:09 +01:00
parent a66b1d4615
commit b183534c81

View File

@@ -1420,12 +1420,12 @@ static int 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); }
/* A NUL is stored in the text as NL */ // A NUL is stored in the text as NL
/* TODO: what if a composing character follows? */ // TODO(vim): what if a composing character follows?
EMIT(nr == 0 ? 0x0a : nr); EMIT(nr == 0 ? 0x0a : nr);
} }
break; break;