forked from aniani/vim
patch 9.0.2107: [security]: FPE in adjust_plines_for_skipcol
Problem: [security]: FPE in adjust_plines_for_skipcol Solution: don't divide by zero, return zero Prevent a floating point exception when calculating w_skipcol (which can happen with a small window when the number option is set and cpo+=n). Add a test to verify Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -45,8 +45,9 @@ adjust_plines_for_skipcol(win_T *wp)
|
||||
return 0;
|
||||
|
||||
int width = wp->w_width - win_col_off(wp);
|
||||
if (wp->w_skipcol >= width)
|
||||
return (wp->w_skipcol - width) / (width + win_col_off2(wp)) + 1;
|
||||
int w2 = width + win_col_off2(wp);
|
||||
if (wp->w_skipcol >= width && w2 > 0)
|
||||
return (wp->w_skipcol - width) / w2 + 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user