]> granicus.if.org Git - vim/commitdiff
patch 8.2.3574: divide by zero v8.2.3574
authorBram Moolenaar <Bram@vim.org>
Tue, 2 Nov 2021 22:48:49 +0000 (22:48 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 2 Nov 2021 22:48:49 +0000 (22:48 +0000)
Problem:    Divide by zero.
Solution:   Don't check for overflow if multiplicand is zero.

src/register.c
src/version.c

index 29ae26bd4864661b430a27577f944713e39efdee..4160c03107faeef363c9075d8e0eb888f201190f 100644 (file)
@@ -2014,8 +2014,9 @@ do_put(
                long multlen = count * yanklen;
 
                totlen = multlen;
-               if (totlen != multlen || totlen / count != yanklen
-                                                 || totlen / yanklen != count)
+               if (count != 0 && yanklen != 0
+                       && (totlen != multlen || totlen / count != yanklen
+                                                || totlen / yanklen != count))
                {
                    emsg(_(e_resulting_text_too_long));
                    break;
index f60263f0278599542e40ebb1a1d5464bd3608fbf..98f666e6e405a85c1c9e9afcc5372eab89ec93a9 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3574,
 /**/
     3573,
 /**/