mirror of
https://github.com/vim/vim.git
synced 2025-07-24 10:45:12 -04:00
patch 8.2.4298: divide by zero with huge tabstop value
Problem: Divide by zero with huge tabstop value. Solution: Reject tabstop value that overflows to zero.
This commit is contained in:
parent
21ebb0899e
commit
fc88df42f1
@ -71,7 +71,7 @@ tabstop_set(char_u *var, int **array)
|
|||||||
int n = atoi((char *)cp);
|
int n = atoi((char *)cp);
|
||||||
|
|
||||||
// Catch negative values, overflow and ridiculous big values.
|
// Catch negative values, overflow and ridiculous big values.
|
||||||
if (n < 0 || n > TABSTOP_MAX)
|
if (n <= 0 || n > TABSTOP_MAX)
|
||||||
{
|
{
|
||||||
semsg(_(e_invalid_argument_str), cp);
|
semsg(_(e_invalid_argument_str), cp);
|
||||||
vim_free(*array);
|
vim_free(*array);
|
||||||
|
@ -146,6 +146,16 @@ func Test_vartabs()
|
|||||||
bwipeout!
|
bwipeout!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_retab_invalid_arg()
|
||||||
|
new
|
||||||
|
call setline(1, "\ttext")
|
||||||
|
retab 0
|
||||||
|
call assert_fails("retab -8", 'E487: Argument must be positive')
|
||||||
|
call assert_fails("retab 10000", 'E475:')
|
||||||
|
call assert_fails("retab 720575940379279360", 'E475:')
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_vartabs_breakindent()
|
func Test_vartabs_breakindent()
|
||||||
CheckOption breakindent
|
CheckOption breakindent
|
||||||
new
|
new
|
||||||
|
@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4298,
|
||||||
/**/
|
/**/
|
||||||
4297,
|
4297,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user