Patch 8.2.3575

6 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 2, 2021, 7:12:00 PM11/2/21
to vim...@googlegroups.com

Patch 8.2.3575 (after 8.2.3574)
Problem: Overflow check still fails when sizeof(int) == sizeof(long).
Solution: Use a float to check the result.
Files: src/register.c


*** ../vim-8.2.3574/src/register.c 2021-11-02 22:48:46.108940741 +0000
--- src/register.c 2021-11-02 23:06:25.257901346 +0000
***************
*** 2011,2022 ****
}

do {
long multlen = count * yanklen;

totlen = multlen;
! if (count != 0 && yanklen != 0
! && (totlen != multlen || totlen / count != yanklen
! || totlen / yanklen != count))
{
emsg(_(e_resulting_text_too_long));
break;
--- 2011,2028 ----
}

do {
+ #ifdef FEAT_FLOAT
+ double multlen = (double)count * (double)yanklen;
+
+ totlen = count * yanklen;
+ if ((double)totlen != multlen)
+ #else
long multlen = count * yanklen;

+ // this only works when sizeof(int) != sizeof(long)
totlen = multlen;
! if (totlen != multlen)
! #endif
{
emsg(_(e_resulting_text_too_long));
break;
*** ../vim-8.2.3574/src/version.c 2021-11-02 22:48:46.108940741 +0000
--- src/version.c 2021-11-02 23:10:51.790810881 +0000
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3575,
/**/

--
From "know your smileys":
(\___/)
(+'.'+) Bunny
(")_(")

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages