mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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)
c5acc0f7fe
This commit is contained in:
parent
ed85d68123
commit
0fa2aefb61
@ -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_misplaced[] = N_("E866: (NFA regexp) Misplaced %c");
|
||||||
static char_u e_ill_char_class[] = N_(
|
static char_u e_ill_char_class[] = N_(
|
||||||
"E877: (NFA regexp) Invalid character class: %" PRId64);
|
"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
|
/* Since the out pointers in the list are always
|
||||||
* uninitialized, we use the pointers themselves
|
* uninitialized, we use the pointers themselves
|
||||||
@ -1499,7 +1500,8 @@ static int nfa_regatom(void)
|
|||||||
c = getchr();
|
c = getchr();
|
||||||
while (ascii_isdigit(c)) {
|
while (ascii_isdigit(c)) {
|
||||||
if (n > (INT32_MAX - (c - '0')) / 10) {
|
if (n > (INT32_MAX - (c - '0')) / 10) {
|
||||||
EMSG(_("E951: \\% value too large"));
|
// overflow.
|
||||||
|
EMSG(_(e_value_too_large));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
n = n * 10 + (c - '0');
|
n = n * 10 + (c - '0');
|
||||||
@ -1526,7 +1528,7 @@ static int nfa_regatom(void)
|
|||||||
limit = INT32_MAX / MB_MAXBYTES;
|
limit = INT32_MAX / MB_MAXBYTES;
|
||||||
}
|
}
|
||||||
if (n >= limit) {
|
if (n >= limit) {
|
||||||
EMSG(_("E951: \\% value too large"));
|
EMSG(_(e_value_too_large));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
EMIT((int)n);
|
EMIT((int)n);
|
||||||
|
Loading…
Reference in New Issue
Block a user