mirror of
https://github.com/neovim/neovim.git
synced 2025-09-20 02:08:17 +00:00
Checks for overflow when parsing string to int
This commit is contained in:
@@ -1499,6 +1499,10 @@ static int nfa_regatom(void)
|
||||
if (c == '<' || c == '>')
|
||||
c = getchr();
|
||||
while (ascii_isdigit(c)) {
|
||||
if (n > (INT_MAX - (c - '0')) / 10) {
|
||||
EMSG(_("E951: \\% value too large"));
|
||||
return FAIL;
|
||||
}
|
||||
n = n * 10 + (c - '0');
|
||||
c = getchr();
|
||||
}
|
||||
|
Reference in New Issue
Block a user