From 0fa2aefb616564b5a8f8aff410d1aa3e9e4dffed Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 3 Jun 2020 23:22:23 -0400 Subject: 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 --- src/nvim/regexp_nfa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/nvim/regexp_nfa.c') 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); -- cgit