From 4e889f98e95ac05d7c8bd3ee933ab4d47820fdfa Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 21 Feb 2022 19:36:12 +0000 Subject: [PATCH] patch 8.2.4436: crash with weird 'vartabstop' value Problem: Crash with weird 'vartabstop' value. Solution: Check for running into the end of the line. --- src/indent.c | 2 ++ src/testdir/test_vartabs.vim | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/indent.c b/src/indent.c index 075802c..6b8900f 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1279,6 +1279,8 @@ change_indent( new_cursor_col += (*mb_ptr2len)(ptr + new_cursor_col); else ++new_cursor_col; + if (ptr[new_cursor_col] == NUL) + break; vcol += lbr_chartabsize(ptr, ptr + new_cursor_col, (colnr_T)vcol); } vcol = last_vcol; diff --git a/src/testdir/test_vartabs.vim b/src/testdir/test_vartabs.vim index 47844fb..c2919d8 100644 --- a/src/testdir/test_vartabs.vim +++ b/src/testdir/test_vartabs.vim @@ -378,3 +378,17 @@ func Test_vartabs_reset() set all& call assert_equal('', &vts) endfunc + +func Test_vartabstop_latin1() + let save_encoding = &encoding + new + set encoding=iso8859 + silent norm :se  + set vartabstop=400 + norm i00  + bwipe! + let &encoding = save_encoding +endfunc + + +" vim: shiftwidth=2 sts=2 expandtab -- 2.27.0