aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-06-03 23:22:23 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-06-04 20:52:53 -0400
commit0fa2aefb616564b5a8f8aff410d1aa3e9e4dffed (patch)
tree6135b076f25e906fe724d313d2648bafd78699ed
parented85d681238ef279f0644df79c1a20e3b9269022 (diff)
downloadrneovim-0fa2aefb616564b5a8f8aff410d1aa3e9e4dffed.tar.gz
rneovim-0fa2aefb616564b5a8f8aff410d1aa3e9e4dffed.tar.bz2
rneovim-0fa2aefb616564b5a8f8aff410d1aa3e9e4dffed.zip
vim-patch:8.2.0892: ubsan warns for undefined behavior
Problem: Ubsan warns for undefined behavior. Solution: Use unsigned instead of signed variable. (Dominique Pelle, closes vim/vim#6193) https://github.com/vim/vim/commit/c5acc0f7fed6b061d994fc5ac660dcc0312750bd
-rw-r--r--src/nvim/regexp_nfa.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index f33c61d39f..2ca5f42e51 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -249,6 +249,7 @@ static char_u e_nul_found[] = N_(
static char_u e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c");
static char_u e_ill_char_class[] = N_(
"E877: (NFA regexp) Invalid character class: %" PRId64);
+static char_u e_value_too_large[] = N_("E951: \\% value too large");
/* Since the out pointers in the list are always
* uninitialized, we use the pointers themselves
@@ -1499,7 +1500,8 @@ static int nfa_regatom(void)
c = getchr();
while (ascii_isdigit(c)) {
if (n > (INT32_MAX - (c - '0')) / 10) {
- EMSG(_("E951: \\% value too large"));
+ // overflow.
+ EMSG(_(e_value_too_large));
return FAIL;
}
n = n * 10 + (c - '0');
@@ -1526,7 +1528,7 @@ static int nfa_regatom(void)
limit = INT32_MAX / MB_MAXBYTES;
}
if (n >= limit) {
- EMSG(_("E951: \\% value too large"));
+ EMSG(_(e_value_too_large));
return FAIL;
}
EMIT((int)n);