mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #5286 from jamessan/strtoimax-error-checking
Fix error-handling of strtoimax boundary conditions
This commit is contained in:
commit
94dfb6cea2
@ -1739,8 +1739,11 @@ char_u* skiptowhite_esc(char_u *p) {
|
|||||||
/// @return Number read from the string.
|
/// @return Number read from the string.
|
||||||
intmax_t getdigits(char_u **pp)
|
intmax_t getdigits(char_u **pp)
|
||||||
{
|
{
|
||||||
|
errno = 0;
|
||||||
intmax_t number = strtoimax((char *)*pp, (char **)pp, 10);
|
intmax_t number = strtoimax((char *)*pp, (char **)pp, 10);
|
||||||
|
if (number == INTMAX_MAX || number == INTMAX_MIN) {
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
|
}
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user