Merge pull request #17298 from zeertzjq/vim-8.2.4298

vim-patch:8.2.4298: divide by zero with huge tabstop value
This commit is contained in:
zeertzjq 2022-02-05 20:33:11 +08:00 committed by GitHub
commit 9d1deed6c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -7551,7 +7551,7 @@ bool tabstop_set(char_u *var, long **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_invarg2), cp); semsg(_(e_invarg2), cp);
XFREE_CLEAR(*array); XFREE_CLEAR(*array);
return false; return false;

View File

@ -135,6 +135,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()
if !exists("+breakindent") if !exists("+breakindent")
return return