mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.1.1411: Coverity warns for divide by zero
Problem: Coverity warns for divide by zero. Solution: Make sure width is larger than zero.
This commit is contained in:
@@ -1105,15 +1105,16 @@ win_lbr_chartabsize(
|
||||
{
|
||||
if (size + sbrlen + numberwidth > (colnr_T)wp->w_width)
|
||||
{
|
||||
/* calculate effective window width */
|
||||
// calculate effective window width
|
||||
int width = (colnr_T)wp->w_width - sbrlen - numberwidth;
|
||||
int prev_width = col
|
||||
? ((colnr_T)wp->w_width - (sbrlen + col)) : 0;
|
||||
if (width == 0)
|
||||
width = (colnr_T)wp->w_width;
|
||||
|
||||
if (width <= 0)
|
||||
width = (colnr_T)1;
|
||||
added += ((size - prev_width) / width) * vim_strsize(p_sbr);
|
||||
if ((size - prev_width) % width)
|
||||
/* wrapped, add another length of 'sbr' */
|
||||
// wrapped, add another length of 'sbr'
|
||||
added += vim_strsize(p_sbr);
|
||||
}
|
||||
else
|
||||
|
@@ -767,6 +767,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1411,
|
||||
/**/
|
||||
1410,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user