Skip to content

Commit

Permalink
patch 8.2.3574: divide by zero
Browse files Browse the repository at this point in the history
Problem:    Divide by zero.
Solution:   Don't check for overflow if multiplicand is zero.
  • Loading branch information
brammool committed Nov 2, 2021
1 parent 69b3072 commit 8a1962d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/register.c
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -757,6 +757,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3574,
/**/
3573,
/**/
Expand Down

0 comments on commit 8a1962d

Please sign in to comment.