Skip to content

Commit 4e889f9

Browse files
committed
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.
1 parent 7842761 commit 4e889f9

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Diff for: src/indent.c

+2
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,8 @@ change_indent(
13381338
new_cursor_col += (*mb_ptr2len)(ptr + new_cursor_col);
13391339
else
13401340
++new_cursor_col;
1341+
if (ptr[new_cursor_col] == NUL)
1342+
break;
13411343
vcol += lbr_chartabsize(ptr, ptr + new_cursor_col, (colnr_T)vcol);
13421344
}
13431345
vcol = last_vcol;

Diff for: src/testdir/test_vartabs.vim

+12
Original file line numberDiff line numberDiff line change
@@ -442,4 +442,16 @@ func Test_shiftwidth_vartabstop()
442442
setlocal shiftwidth& vartabstop& tabstop&
443443
endfunc
444444

445+
func Test_vartabstop_latin1()
446+
let save_encoding = &encoding
447+
new
448+
set encoding=iso8859
449+
silent norm :se 
450+
set vartabstop=400
451+
norm i00 
452+
bwipe!
453+
let &encoding = save_encoding
454+
endfunc
455+
456+
445457
" vim: shiftwidth=2 sts=2 expandtab

Diff for: src/version.c

+2
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
4436,
753755
/**/
754756
4435,
755757
/**/

0 commit comments

Comments
 (0)