aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-02-28 12:08:09 +0100
committerJustin M. Keyes <justinkz@gmail.com>2019-03-01 01:56:17 +0100
commitb183534c819a91b9e077c55f522db27ea7f7d910 (patch)
treee71ff78afc905866066dd4f917aa57a4fe4c49a0 /src
parenta66b1d4615502d7bc89a97b9e8f5f8d2c6b90cd8 (diff)
downloadrneovim-b183534c819a91b9e077c55f522db27ea7f7d910.tar.gz
rneovim-b183534c819a91b9e077c55f522db27ea7f7d910.tar.bz2
rneovim-b183534c819a91b9e077c55f522db27ea7f7d910.zip
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) https://github.com/vim/vim/commit/527a2d86fb375fcc7b34e80fc47f4c7126fc12ba
Diffstat (limited to 'src')
-rw-r--r--src/nvim/regexp_nfa.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index d34e653058..d1369e4532 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -1420,12 +1420,12 @@ static int nfa_regatom(void)
default: nr = -1; break;
}
- if (nr < 0)
- EMSG2_RET_FAIL(
- _("E678: Invalid character after %s%%[dxouU]"),
- reg_magic == MAGIC_ALL);
- /* A NUL is stored in the text as NL */
- /* TODO: what if a composing character follows? */
+ if (nr < 0 || nr > INT_MAX) {
+ EMSG2_RET_FAIL(_("E678: Invalid character after %s%%[dxouU]"),
+ reg_magic == MAGIC_ALL);
+ }
+ // A NUL is stored in the text as NL
+ // TODO(vim): what if a composing character follows?
EMIT(nr == 0 ? 0x0a : nr);
}
break;