getdigits() uses atol(), whose overflow behavior is not portable. On Solaris, overflowing atol() can return a wrapped positive value without ERANGE, so Ex address parsing (like :999999999999999999999print) misses the intended out-of-range condition. Use strtol() on Solaris and clamp overflow to the same sentinel values expected by callers. This fixes the Test_address_line_overflow() failure in test_excmd.vim.
https://github.com/vim/vim/pull/20602
(1 file)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
I don't really like having system specific ifdefs here. Can't we use something like the following instead:
diff --git a/src/charset.c b/src/charset.c index bf7c59620..ab860a099 100644 --- a/src/charset.c +++ b/src/charset.c @@ -2227,15 +2227,18 @@ skiptowhite_esc(char_u *p) getdigits(char_u **pp) { char_u *p; - long retval; + varnumber_T number; + int len; p = *pp; - retval = atol((char *)p); - if (*p == '-') // skip negative sign - ++p; - p = skipdigits(p); // skip to next non-digit - *pp = p; - return retval; + + vim_str2nr(p, NULL, &len, 0, &number, NULL, 0, FALSE, NULL); + if (number > LONG_MAX) + number = LONG_MAX; + else if (number < LONG_MIN) + number = LONG_MIN; + *pp = p + len; + return (long)number; } /*
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
I can confirm, the suggested diff makes the test(s) pass on solaris on both architectures.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()