From 3932268f50e3d0360b2af8c58da7271775adb82b Mon Sep 17 00:00:00 2001 From: youmu314 Date: Wed, 13 Dec 2023 01:33:52 +0800 Subject: [PATCH] =?UTF-8?q?CVE-2023-0288=20=E5=AE=89=E5=85=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=EF=BC=9AHeap-based=20Buffer=20Overflow=20in=20Github?= =?UTF-8?q?=20respository=20vim/vim=20prior=209.0.1189.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/normal.c | 3 ++- src/testdir/test_fold.vim | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/normal.c b/src/normal.c index c20c072..aa1fca5 100644 --- a/src/normal.c +++ b/src/normal.c @@ -3826,7 +3826,8 @@ nv_scroll(cmdarg_T *cap) { (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL); - --curwin->w_cursor.lnum; + if(curwin->w_cursor.lnum > curwin->w_toplin) + --curwin->w_cursor.lnum; } } else diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim index 824a4f2..2de4807 100644 --- a/src/testdir/test_fold.vim +++ b/src/testdir/test_fold.vim @@ -769,3 +769,13 @@ func Test_fold_delete_with_marker_and_whichwrap() set fdm& ww& bwipe! endfunc + +func Test_indent_with_L_command() + " The "L" command moved the cursor to line zero, causing the text saved for + " undo to use line number -1, which caused trouble for undo later. + new + sil! norm 8R +V{zf8=Lu + bwipe! +endfunc + -- Gitee