mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 19:25:11 -07:00
vim-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.
fc88df42f1
This commit is contained in:
parent
806a7c976d
commit
e6cfd20b7f
@ -7551,7 +7551,7 @@ bool tabstop_set(char_u *var, long **array)
|
||||
int n = atoi((char *)cp);
|
||||
|
||||
// Catch negative values, overflow and ridiculous big values.
|
||||
if (n < 0 || n > TABSTOP_MAX) {
|
||||
if (n <= 0 || n > TABSTOP_MAX) {
|
||||
semsg(_(e_invarg2), cp);
|
||||
XFREE_CLEAR(*array);
|
||||
return false;
|
||||
|
@ -135,6 +135,16 @@ func Test_vartabs()
|
||||
bwipeout!
|
||||
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()
|
||||
if !exists("+breakindent")
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user