patch 9.0.1189: invalid memory access with folding and using "L"
Problem: Invalid memory access with folding and using "L".
Solution: Prevent the cursor from moving to line zero.
diff --git a/src/normal.c b/src/normal.c
index c319be5..3d9f74d 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -3729,7 +3729,8 @@
{
(void)hasFolding(curwin->w_cursor.lnum,
&curwin->w_cursor.lnum, NULL);
- --curwin->w_cursor.lnum;
+ if (curwin->w_cursor.lnum > curwin->w_topline)
+ --curwin->w_cursor.lnum;
}
}
else
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim
index adf9e52..f915a66 100644
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
Binary files differ
diff --git a/src/version.c b/src/version.c
index 1d81e7b..64f7d88 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1189,
+/**/
1188,
/**/
1187,