!275 upgrade version to 9.0

From: @tong_1001 
Reviewed-by: @lvying6 
Signed-off-by: @lvying6
This commit is contained in:
openeuler-ci-bot 2022-07-28 02:43:48 +00:00 committed by Gitee
commit 5e952e933f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
91 changed files with 152 additions and 6540 deletions

View File

@ -1,56 +0,0 @@
From ea3ebd50e2a4ec26ee503f352a1280e11e4af93b Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Tue, 14 Jul 2020 12:14:03 +0200
Subject: [PATCH] if_lua.c: new Lua 5.4.0 defines luaL_typeerror, so don't
define it twice
---
src/if_lua.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/if_lua.c b/src/if_lua.c
index 9b03c97..81faf92 100644
--- a/src/if_lua.c
+++ b/src/if_lua.c
@@ -109,6 +109,9 @@ static luaV_Funcref *luaV_pushfuncref(lua_State *L, char_u *name);
#define luaL_loadbufferx dll_luaL_loadbufferx
#define luaL_argerror dll_luaL_argerror
#endif
+#if LUA_VERSION_NUM >= 504
+#define luaL_typeerror dll_luaL_typeerror
+#endif
#define luaL_checkany dll_luaL_checkany
#define luaL_checklstring dll_luaL_checklstring
#define luaL_checkinteger dll_luaL_checkinteger
@@ -203,6 +206,9 @@ int (*dll_luaL_loadfilex) (lua_State *L, const char *filename, const char *mode)
int (*dll_luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode);
int (*dll_luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
#endif
+#if LUA_VERSION_NUM >= 504
+int (*dll_luaL_typeerror) (lua_State *L, int narg, const char *tname);
+#endif
void (*dll_luaL_checkany) (lua_State *L, int narg);
const char *(*dll_luaL_checklstring) (lua_State *L, int numArg, size_t *l);
lua_Integer (*dll_luaL_checkinteger) (lua_State *L, int numArg);
@@ -314,6 +320,9 @@ static const luaV_Reg luaV_dll[] = {
{"luaL_loadfilex", (luaV_function) &dll_luaL_loadfilex},
{"luaL_loadbufferx", (luaV_function) &dll_luaL_loadbufferx},
{"luaL_argerror", (luaV_function) &dll_luaL_argerror},
+#endif
+#if LUA_VERSION_NUM >= 504
+ {"luaL_typeerror", (luaV_function) &dll_luaL_typeerror},
#endif
{"luaL_checkany", (luaV_function) &dll_luaL_checkany},
{"luaL_checklstring", (luaV_function) &dll_luaL_checklstring},
@@ -443,7 +452,7 @@ lua_enabled(int verbose)
}
#endif
-#if LUA_VERSION_NUM > 501
+#if LUA_VERSION_NUM > 501 && LUA_VERSION_NUM < 504
static int
luaL_typeerror(lua_State *L, int narg, const char *tname)
{
--
2.23.0

View File

@ -1,132 +0,0 @@
From 0e62a6742bca186624e97e2121c98ada30e009a0 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 25 Feb 2021 17:17:56 +0100
Subject: [PATCH 4236/5000] patch 8.2.2550: signal stack size is wrong with
latest glibc 2.34
Problem: Signal stack size is wrong with latest glibc 2.34.
Solution: Use sysconf(_SC_SIGSTKSZ) if available. (Zdenek Dohnal, closes
#7895)
---
src/auto/configure | 24 ++++++++++++++++++++++++
src/config.h.in | 3 +++
src/configure.ac | 9 +++++++++
src/os_unix.c | 14 +++++++++++++-
4 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/src/auto/configure b/src/auto/configure
index 250e5ae..8183499 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -13943,6 +13943,30 @@ $as_echo "not usable" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _SC_SIGSTKSZ via sysconf()" >&5
+$as_echo_n "checking for _SC_SIGSTKSZ via sysconf()... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <unistd.h>
+int
+main ()
+{
+ (void)sysconf(_SC_SIGSTKSZ);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }; $as_echo "#define HAVE_SYSCONF_SIGSTKSZ 1" >>confdefs.h
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not usable" >&5
+$as_echo "not usable" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
diff --git a/src/config.h.in b/src/config.h.in
index b114480..5d01e2c 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -496,3 +496,6 @@
/* Define to inline symbol or empty */
#undef inline
+
+/* Define if _SC_SIGSTKSZ is available via sysconf() */
+#undef HAVE_SYSCONF_SIGSTKSZ
diff --git a/src/configure.ac b/src/configure.ac
index 58bfa19..798e9b8 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -4105,6 +4105,15 @@ AC_TRY_COMPILE(
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
AC_MSG_RESULT(not usable))
+dnl check if we have _SC_SIGSTKSZ via sysconf()
+AC_MSG_CHECKING(for _SC_SIGSTKSZ via sysconf())
+AC_TRY_COMPILE(
+[#include <unistd.h>],
+[ (void)sysconf(_SC_SIGSTKSZ);
+ ],
+ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF_SIGSTKSZ),
+ AC_MSG_RESULT(not usable))
+
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([time_t])
diff --git a/src/os_unix.c b/src/os_unix.c
index 1edc7e6..1c80799 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -783,7 +783,7 @@ mch_stackcheck(char *p)
* completely full.
*/
-#ifndef SIGSTKSZ
+#if !defined SIGSTKSZ && !defined(HAVE_SYSCONF_SIGSTKSZ)
# define SIGSTKSZ 8000 // just a guess of how much stack is needed...
#endif
@@ -806,13 +806,21 @@ init_signal_stack(void)
# else
sigstk.ss_sp = signal_stack;
# endif
+# ifdef HAVE_SYSCONF_SIGSTKSZ
+ sigstk.ss_size = sysconf(_SC_SIGSTKSZ);
+# else
sigstk.ss_size = SIGSTKSZ;
+# endif
sigstk.ss_flags = 0;
(void)sigaltstack(&sigstk, NULL);
# else
sigstk.ss_sp = signal_stack;
if (stack_grows_downwards)
+# ifdef HAVE_SYSCONF_SIGSTKSZ
+ sigstk.ss_sp += sysconf(_SC_SIGSTKSZ) - 1;
+# else
sigstk.ss_sp += SIGSTKSZ - 1;
+# endif
sigstk.ss_onstack = 0;
(void)sigstack(&sigstk, NULL);
# endif
@@ -3261,7 +3269,11 @@ mch_early_init(void)
* Ignore any errors.
*/
#if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
+# ifdef HAVE_SYSCONF_SIGSTKSZ
+ signal_stack = alloc(sysconf(_SC_SIGSTKSZ));
+# else
signal_stack = alloc(SIGSTKSZ);
+# endif
init_signal_stack();
#endif
}
--
1.8.3.1

View File

@ -1,206 +0,0 @@
From b7081e135a16091c93f6f5f7525a5c58fb7ca9f9 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 4 Sep 2021 18:47:28 +0200
Subject: [PATCH] patch 8.2.3402: invalid memory access when using :retab with
large value
Problem: Invalid memory access when using :retab with large value.
Solution: Check the number is positive.
---
src/indent.c | 34 +++++++++++++++++++++-------------
src/option.c | 12 ++++++------
src/optionstr.c | 4 ++--
src/testdir/test_retab.vim | 3 +++
src/version.c | 2 ++
5 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/src/indent.c b/src/indent.c
index 32f1e12..7e196c2 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -18,18 +18,19 @@
/*
* Set the integer values corresponding to the string setting of 'vartabstop'.
* "array" will be set, caller must free it if needed.
+ * Return FAIL for an error.
*/
int
tabstop_set(char_u *var, int **array)
{
- int valcount = 1;
- int t;
- char_u *cp;
+ int valcount = 1;
+ int t;
+ char_u *cp;
if (var[0] == NUL || (var[0] == '0' && var[1] == NUL))
{
*array = NULL;
- return TRUE;
+ return OK;
}
for (cp = var; *cp != NUL; ++cp)
@@ -43,8 +44,8 @@ tabstop_set(char_u *var, int **array)
if (cp != end)
emsg(_(e_positive));
else
- emsg(_(e_invarg));
- return FALSE;
+ semsg(_(e_invarg2), cp);
+ return FAIL;
}
}
@@ -55,26 +56,33 @@ tabstop_set(char_u *var, int **array)
++valcount;
continue;
}
- emsg(_(e_invarg));
- return FALSE;
+ semsg(_(e_invarg2), var);
+ return FAIL;
}
*array = ALLOC_MULT(int, valcount + 1);
if (*array == NULL)
- return FALSE;
+ return FAIL;
(*array)[0] = valcount;
t = 1;
for (cp = var; *cp != NUL;)
{
- (*array)[t++] = atoi((char *)cp);
- while (*cp != NUL && *cp != ',')
+ int n = atoi((char *)cp);
+
+ if (n < 0 || n > 9999)
+ {
+ semsg(_(e_invarg2), cp);
+ return FAIL;
+ }
+ (*array)[t++] = n;
+ while (*cp != NUL && *cp != ',')
++cp;
if (*cp != NUL)
++cp;
}
- return TRUE;
+ return OK;
}
/*
@@ -1556,7 +1564,7 @@ ex_retab(exarg_T *eap)
#ifdef FEAT_VARTABS
new_ts_str = eap->arg;
- if (!tabstop_set(eap->arg, &new_vts_array))
+ if (tabstop_set(eap->arg, &new_vts_array) == FAIL)
return;
while (vim_isdigit(*(eap->arg)) || *(eap->arg) == ',')
++(eap->arg);
diff --git a/src/option.c b/src/option.c
index 5c99c69..e9598d6 100644
--- a/src/option.c
+++ b/src/option.c
@@ -2292,9 +2292,9 @@ didset_options2(void)
#endif
#ifdef FEAT_VARTABS
vim_free(curbuf->b_p_vsts_array);
- tabstop_set(curbuf->b_p_vsts, &curbuf->b_p_vsts_array);
+ (void)tabstop_set(curbuf->b_p_vsts, &curbuf->b_p_vsts_array);
vim_free(curbuf->b_p_vts_array);
- tabstop_set(curbuf->b_p_vts, &curbuf->b_p_vts_array);
+ (void)tabstop_set(curbuf->b_p_vts, &curbuf->b_p_vts_array);
#endif
}
@@ -5756,7 +5756,7 @@ buf_copy_options(buf_T *buf, int flags)
buf->b_p_vsts = vim_strsave(p_vsts);
COPY_OPT_SCTX(buf, BV_VSTS);
if (p_vsts && p_vsts != empty_option)
- tabstop_set(p_vsts, &buf->b_p_vsts_array);
+ (void)tabstop_set(p_vsts, &buf->b_p_vsts_array);
else
buf->b_p_vsts_array = 0;
buf->b_p_vsts_nopaste = p_vsts_nopaste
@@ -5914,7 +5914,7 @@ buf_copy_options(buf_T *buf, int flags)
buf->b_p_isk = save_p_isk;
#ifdef FEAT_VARTABS
if (p_vts && p_vts != empty_option && !buf->b_p_vts_array)
- tabstop_set(p_vts, &buf->b_p_vts_array);
+ (void)tabstop_set(p_vts, &buf->b_p_vts_array);
else
buf->b_p_vts_array = NULL;
#endif
@@ -5929,7 +5929,7 @@ buf_copy_options(buf_T *buf, int flags)
buf->b_p_vts = vim_strsave(p_vts);
COPY_OPT_SCTX(buf, BV_VTS);
if (p_vts && p_vts != empty_option && !buf->b_p_vts_array)
- tabstop_set(p_vts, &buf->b_p_vts_array);
+ (void)tabstop_set(p_vts, &buf->b_p_vts_array);
else
buf->b_p_vts_array = NULL;
#endif
@@ -6634,7 +6634,7 @@ paste_option_changed(void)
if (buf->b_p_vsts_array)
vim_free(buf->b_p_vsts_array);
if (buf->b_p_vsts && buf->b_p_vsts != empty_option)
- tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array);
+ (void)tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array);
else
buf->b_p_vsts_array = 0;
#endif
diff --git a/src/optionstr.c b/src/optionstr.c
index 98e90a4..383babe 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -2166,7 +2166,7 @@ did_set_string_option(
if (errmsg == NULL)
{
int *oldarray = curbuf->b_p_vsts_array;
- if (tabstop_set(*varp, &(curbuf->b_p_vsts_array)))
+ if (tabstop_set(*varp, &(curbuf->b_p_vsts_array)) == OK)
{
if (oldarray)
vim_free(oldarray);
@@ -2205,7 +2205,7 @@ did_set_string_option(
{
int *oldarray = curbuf->b_p_vts_array;
- if (tabstop_set(*varp, &(curbuf->b_p_vts_array)))
+ if (tabstop_set(*varp, &(curbuf->b_p_vts_array)) == OK)
{
vim_free(oldarray);
#ifdef FEAT_FOLDING
diff --git a/src/testdir/test_retab.vim b/src/testdir/test_retab.vim
index f11a32b..e7b8946 100644
--- a/src/testdir/test_retab.vim
+++ b/src/testdir/test_retab.vim
@@ -74,4 +74,7 @@ endfunc
func Test_retab_error()
call assert_fails('retab -1', 'E487:')
call assert_fails('retab! -1', 'E487:')
+ call assert_fails('ret -1000', 'E487:')
+ call assert_fails('ret 10000', 'E475:')
+ call assert_fails('ret 80000000000000000000', 'E475:')
endfunc
diff --git a/src/version.c b/src/version.c
index 3ef6259..8912f62 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3402,
+/**/
0
};
--
1.8.3.1

View File

@ -1,46 +0,0 @@
From 65b605665997fad54ef39a93199e305af2fe4d7f Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 7 Sep 2021 19:26:53 +0200
Subject: [PATCH] patch 8.2.3409: reading beyond end of line with invalid utf-8
character
Problem: Reading beyond end of line with invalid utf-8 character.
Solution: Check for NUL when advancing.
---
src/regexp_nfa.c | 3 ++-
src/testdir/test_regexp_utf8.vim | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index fb512f9..bc4a4b6 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -5455,7 +5455,8 @@ find_match_text(colnr_T startcol, int regstart, char_u *match_text)
match = FALSE;
break;
}
- len2 += MB_CHAR2LEN(c2);
+ len2 += enc_utf8 ? utf_ptr2len(rex.line + col + len2)
+ : MB_CHAR2LEN(c2);
}
if (match
// check that no composing char follows
diff --git a/src/testdir/test_regexp_utf8.vim b/src/testdir/test_regexp_utf8.vim
index 19ff882..6d0ce59 100644
--- a/src/testdir/test_regexp_utf8.vim
+++ b/src/testdir/test_regexp_utf8.vim
@@ -215,3 +215,11 @@ func Test_optmatch_toolong()
set re=0
endfunc
+func Test_match_invalid_byte()
+ call writefile(0z630a.765d30aa0a.2e0a.790a.4030, 'Xinvalid')
+ new
+ source Xinvalid
+ bwipe!
+ call delete('Xinvalid')
+endfunc
+
--
1.8.3.1

View File

@ -1,67 +0,0 @@
From 35a9a00afcb20897d462a766793ff45534810dc3 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 11 Sep 2021 21:14:20 +0200
Subject: [PATCH] patch 8.2.3428: using freed memory when replacing
Problem: Using freed memory when replacing. (Dhiraj Mishra)
Solution: Get the line pointer after calling ins_copychar().
---
src/normal.c | 10 +++++++---
src/testdir/test_edit.vim | 13 +++++++++++++
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/normal.c b/src/normal.c
index c4963e6..d6333b9 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -5009,19 +5009,23 @@ nv_replace(cmdarg_T *cap)
{
/*
* Get ptr again, because u_save and/or showmatch() will have
- * released the line. At the same time we let know that the
- * line will be changed.
+ * released the line. This may also happen in ins_copychar().
+ * At the same time we let know that the line will be changed.
*/
- ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)
{
int c = ins_copychar(curwin->w_cursor.lnum
+ (cap->nchar == Ctrl_Y ? -1 : 1));
+
+ ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
if (c != NUL)
ptr[curwin->w_cursor.col] = c;
}
else
+ {
+ ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
ptr[curwin->w_cursor.col] = cap->nchar;
+ }
if (p_sm && msg_silent == 0)
showmatch(cap->nchar);
++curwin->w_cursor.col;
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index 4e29e7f..c3b1af5 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -1519,3 +1519,16 @@ func Test_edit_noesckeys()
bwipe!
set esckeys
endfunc
+
+" Test for getting the character of the line below after "p"
+func Test_edit_put_CTRL_E()
+ set encoding=latin1
+ new
+ let @" = ''
+ sil! norm orggRx
+ sil! norm pr
+ call assert_equal(['r', 'r'], getline(1, 2))
+ bwipe!
+ set encoding=utf-8
+endfunc
+
--
1.8.3.1

View File

@ -1,70 +0,0 @@
From 826bfe4bbd7594188e3d74d2539d9707b1c6a14b Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 8 Oct 2021 18:39:28 +0100
Subject: [PATCH] patch 8.2.3487: illegal memory access if buffer name is very
long
Problem: Illegal memory access if buffer name is very long.
Solution: Make sure not to go over the end of the buffer.
---
src/drawscreen.c | 10 +++++-----
src/testdir/test_statusline.vim | 10 ++++++++++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 3a88ee9..9acb705 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -446,13 +446,13 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
*(p + len++) = ' ';
if (bt_help(wp->w_buffer))
{
- STRCPY(p + len, _("[Help]"));
+ vim_snprintf((char *)p + len, MAXPATHL - len, "%s", _("[Help]"));
len += (int)STRLEN(p + len);
}
#ifdef FEAT_QUICKFIX
if (wp->w_p_pvw)
{
- STRCPY(p + len, _("[Preview]"));
+ vim_snprintf((char *)p + len, MAXPATHL - len, "%s", _("[Preview]"));
len += (int)STRLEN(p + len);
}
#endif
@@ -462,12 +462,12 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
#endif
)
{
- STRCPY(p + len, "[+]");
- len += 3;
+ vim_snprintf((char *)p + len, MAXPATHL - len, "%s", "[+]");
+ len += (int)STRLEN(p + len);
}
if (wp->w_buffer->b_p_ro)
{
- STRCPY(p + len, _("[RO]"));
+ vim_snprintf((char *)p + len, MAXPATHL - len, "%s", _("[RO]"));
len += (int)STRLEN(p + len);
}
diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim
index 1f705b8..febb5d6 100644
--- a/src/testdir/test_statusline.vim
+++ b/src/testdir/test_statusline.vim
@@ -393,3 +393,13 @@ func Test_statusline_visual()
bwipe! x1
bwipe! x2
endfunc
+
+" Used to write beyond allocated memory. This assumes MAXPATHL is 4096 bytes.
+func Test_statusline_verylong_filename()
+ let fname = repeat('x', 4090)
+ exe "new " .. fname
+ set buftype=help
+ set previewwindow
+ redraw
+ bwipe!
+endfunc
--
2.27.0

View File

@ -1,54 +0,0 @@
From 35a319b77f897744eec1155b736e9372c9c5575f Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 9 Oct 2021 13:58:55 +0100
Subject: [PATCH] patch 8.2.3489: ml_get error after search with range
Problem: ml_get error after search with range.
Solution: Limit the line number to the buffer line count.
---
src/ex_docmd.c | 6 ++++--
src/testdir/test_search.vim | 14 ++++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 76daf43..12554fa 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3586,8 +3586,10 @@ get_address(
// When '/' or '?' follows another address, start from
// there.
- if (lnum != MAXLNUM)
- curwin->w_cursor.lnum = lnum;
+ if (lnum > 0 && lnum != MAXLNUM)
+ curwin->w_cursor.lnum =
+ lnum > curbuf->b_ml.ml_line_count
+ ? curbuf->b_ml.ml_line_count : lnum;
// Start a forward search at the end of the line (unless
// before the first line).
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 1876713..ac0881c 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1366,3 +1366,17 @@ func Test_searchdecl()
bwipe!
endfunc
+
+func Test_search_with_invalid_range()
+ new
+ let lines =<< trim END
+ /\%.v
+ 5/
+ c
+ END
+ call writefile(lines, 'Xrangesearch')
+ source Xrangesearch
+
+ bwipe!
+ call delete('Xrangesearch')
+endfunc
--
2.27.0

View File

@ -1,78 +0,0 @@
From 777e7c21b7627be80961848ac560cb0a9978ff43 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 25 Oct 2021 17:07:04 +0100
Subject: [PATCH] patch 8.2.3564: invalid memory access when scrolling without
valid screen
Problem: Invalid memory access when scrolling without a valid screen.
Solution: Do not set VALID_BOTLINE in w_valid.
---
src/move.c | 1 -
src/testdir/test_normal.vim | 22 +++++++++++++++++++---
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/move.c b/src/move.c
index 8e53d8b..10165ef 100644
--- a/src/move.c
+++ b/src/move.c
@@ -198,7 +198,6 @@ update_topline(void)
{
curwin->w_topline = curwin->w_cursor.lnum;
curwin->w_botline = curwin->w_topline;
- curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP;
curwin->w_scbind_pos = 1;
return;
}
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index d45cf41..1f0088a 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -33,14 +33,14 @@ func CountSpaces(type, ...)
else
silent exe "normal! `[v`]y"
endif
- let g:a=strlen(substitute(@@, '[^ ]', '', 'g'))
+ let g:a = strlen(substitute(@@, '[^ ]', '', 'g'))
let &selection = sel_save
let @@ = reg_save
endfunc
func OpfuncDummy(type, ...)
" for testing operatorfunc
- let g:opt=&linebreak
+ let g:opt = &linebreak
if a:0 " Invoked from Visual mode, use gv command.
silent exe "normal! gvy"
@@ -51,7 +51,7 @@ func OpfuncDummy(type, ...)
endif
" Create a new dummy window
new
- let g:bufnr=bufnr('%')
+ let g:bufnr = bufnr('%')
endfunc
fun! Test_normal00_optrans()
@@ -2705,3 +2705,19 @@ func Test_normal_gk()
bw!
set cpoptions& number& numberwidth&
endfunc
+
+func Test_scroll_in_ex_mode()
+ " This was using invalid memory because w_botline was invalid.
+ let lines =<< trim END
+ diffsplit
+ norm os00(
+ call writefile(['done'], 'Xdone')
+ qa!
+ END
+ call writefile(lines, 'Xscript')
+ call assert_equal(1, RunVim([], [], '--clean -X -Z -e -s -S Xscript'))
+ call assert_equal(['done'], readfile('Xdone'))
+
+ call delete('Xscript')
+ call delete('Xdone')
+endfunc
--
1.8.3.1

View File

@ -1,44 +0,0 @@
From 0b5b06cb4777d1401fdf83e7d48d287662236e7e Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 4 Nov 2021 15:10:11 +0000
Subject: [PATCH] patch 8.2.3581: reading character past end of line
Problem: Reading character past end of line.
Solution: Correct the cursor column.
---
src/ex_docmd.c | 1 +
src/testdir/test_put.vim | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 12554fa..203174a 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -6906,6 +6906,7 @@ ex_put(exarg_T *eap)
eap->forceit = TRUE;
}
curwin->w_cursor.lnum = eap->line2;
+ check_cursor_col();
do_put(eap->regname, eap->forceit ? BACKWARD : FORWARD, 1L,
PUT_LINE|PUT_CURSLINE);
}
diff --git a/src/testdir/test_put.vim b/src/testdir/test_put.vim
index 225ebd1..f5037dc 100644
--- a/src/testdir/test_put.vim
+++ b/src/testdir/test_put.vim
@@ -113,3 +113,12 @@ func Test_put_p_indent_visual()
call assert_equal('select that text', getline(2))
bwipe!
endfunc
+
+func Test_put_above_first_line()
+ new
+ let @" = 'text'
+ silent! normal 0o00
+ 0put
+ call assert_equal('text', getline(1))
+ bwipe!
+endfunc
--
1.8.3.1

View File

@ -1,48 +0,0 @@
From 15d9890eee53afc61eb0a03b878a19cb5672f732 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 4 Nov 2021 15:46:05 +0000
Subject: [PATCH] patch 8.2.3582: reading uninitialized memory when giving
spell suggestions
Problem: Reading uninitialized memory when giving spell suggestions.
Solution: Check that preword is not empty.
---
src/spellsuggest.c | 2 +-
src/testdir/test_spell.vim | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/spellsuggest.c b/src/spellsuggest.c
index 9d6df79..8615d52 100644
--- a/src/spellsuggest.c
+++ b/src/spellsuggest.c
@@ -1600,7 +1600,7 @@ suggest_trie_walk(
// char, e.g., "thes," -> "these".
p = fword + sp->ts_fidx;
MB_PTR_BACK(fword, p);
- if (!spell_iswordp(p, curwin))
+ if (!spell_iswordp(p, curwin) && *preword != NUL)
{
p = preword + STRLEN(preword);
MB_PTR_BACK(preword, p);
diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim
index 79fb892..e435e91 100644
--- a/src/testdir/test_spell.vim
+++ b/src/testdir/test_spell.vim
@@ -498,6 +498,14 @@ func Test_spell_screendump()
call delete('XtestSpell')
endfunc
+func Test_spell_single_word()
+ new
+ silent! norm 0R00
+ spell! ßÂ
+ silent 0norm 0r$ Dvz=
+ bwipe!
+endfunc
+
let g:test_data_aff1 = [
\"SET ISO8859-1",
\"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
--
1.8.3.1

View File

@ -1,79 +0,0 @@
From 615ddd5342b50a6878a907062aa471740bd9a847 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Wed, 17 Nov 2021 18:00:31 +0000
Subject: [PATCH] patch 8.2.3611: crash when using CTRL-W f without finding a
file name
Problem: Crash when using CTRL-W f without finding a file name.
Solution: Bail out when the file name length is zero.
Reference:https://github.com/vim/vim/commit/615ddd5342b50a6878a907062aa471740bd9a847
---
src/findfile.c | 8 ++++++++
src/normal.c | 6 ++++--
src/testdir/test_visual.vim | 8 ++++++++
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/findfile.c b/src/findfile.c
index ba996c4..7a4dfe5 100644
--- a/src/findfile.c
+++ b/src/findfile.c
@@ -1727,6 +1727,9 @@ find_file_in_path_option(
proc->pr_WindowPtr = (APTR)-1L;
# endif
+ if (len == 0)
+ return NULL;
+
if (first == TRUE)
{
// copy file name into NameBuff, expanding environment variables
@@ -2103,7 +2106,12 @@ find_file_name_in_path(
int c;
# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
char_u *tofree = NULL;
+# endif
+ if (len == 0)
+ return NULL;
+
+# if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
if ((options & FNAME_INCL) && *curbuf->b_p_inex != NUL)
{
tofree = eval_includeexpr(ptr, len);
diff --git a/src/normal.c b/src/normal.c
index d6333b9..e9e587d 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -3778,8 +3778,10 @@ get_visual_text(
*pp = ml_get_pos(&VIsual);
*lenp = curwin->w_cursor.col - VIsual.col + 1;
}
- if (has_mbyte)
- // Correct the length to include the whole last character.
+ if (**pp == NUL)
+ *lenp = 0;
+ if (has_mbyte && *lenp > 0)
+ // Correct the length to include all bytes of the last character.
*lenp += (*mb_ptr2len)(*pp + (*lenp - 1)) - 1;
}
reset_VIsual_and_resel();
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index ae28123..0705fdb 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -894,4 +894,12 @@ func Test_block_insert_replace_tabs()
bwipe!
endfunc
+func Test_visual_block_ctrl_w_f()
+ " Emtpy block selected in new buffer should not result in an error.
+ au! BufNew foo sil norm f
+ edit foo
+
+ au! BufNew
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
--
2.23.0

View File

@ -1,67 +0,0 @@
From 64066b9acd9f8cffdf4840f797748f938a13f2d6 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Wed, 17 Nov 2021 18:22:56 +0000
Subject: [PATCH] patch 8.2.3612: using freed memory with regexp using a mark
Problem: Using freed memory with regexp using a mark.
Solution: Get the line again after getting the mark position.
Reference:https://github.com/vim/vim/commit/64066b9acd9f8cffdf4840f797748f938a13f2d6
---
src/regexp.c | 2 +-
src/regexp_nfa.c | 8 ++++++++
src/testdir/test_regexp_latin.vim | 8 ++++++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/regexp.c b/src/regexp.c
index 112f753..2e94e5a 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -1092,7 +1092,7 @@ typedef struct {
// The current match-position is stord in these variables:
linenr_T lnum; // line number, relative to first line
char_u *line; // start of current line
- char_u *input; // current input, points into "regline"
+ char_u *input; // current input, points into "line"
int need_clear_subexpr; // subexpressions still need to be cleared
#ifdef FEAT_SYN_HL
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index bc4a4b6..433523e 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -6623,8 +6623,16 @@ nfa_regmatch(
case NFA_MARK_GT:
case NFA_MARK_LT:
{
+ size_t col = rex.input - rex.line;
pos_T *pos = getmark_buf(rex.reg_buf, t->state->val, FALSE);
+ // Line may have been freed, get it again.
+ if (REG_MULTI)
+ {
+ rex.line = reg_getline(rex.lnum);
+ rex.input = rex.line + col;
+ }
+
// Compare the mark position to the match position.
result = (pos != NULL // mark doesn't exist
&& pos->lnum > 0 // mark isn't set in reg_buf
diff --git a/src/testdir/test_regexp_latin.vim b/src/testdir/test_regexp_latin.vim
index 7a4d98f..3168edc 100644
--- a/src/testdir/test_regexp_latin.vim
+++ b/src/testdir/test_regexp_latin.vim
@@ -141,3 +141,11 @@ func Test_pattern_compile_speed()
call assert_inrange(0.01, 10.0, reltimefloat(reltime(start)))
set spc=
endfunc
+
+func Test_using_mark_position()
+ " this was using freed memory
+ new
+ norm O0
+ call assert_fails("s/\\%')", 'E486:')
+ bwipe!
+endfunc
--
2.23.0

View File

@ -1,64 +0,0 @@
From 2de9b7c7c8791da8853a9a7ca9c467867465b655 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 19 Nov 2021 19:41:13 +0000
Subject: [PATCH] patch 8.2.3625: illegal memory access when C-indenting
Problem: Illegal memory access when C-indenting.
Solution: Also set the cursor column.
---
src/cindent.c | 10 +++++-----
src/testdir/test_cindent.vim | 12 ++++++++++++
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/cindent.c b/src/cindent.c
index c7caed6..28d1558 100644
--- a/src/cindent.c
+++ b/src/cindent.c
@@ -1635,10 +1635,10 @@ get_baseclass_amount(int col)
static pos_T *
find_start_brace(void) // XXX
{
- pos_T cursor_save;
- pos_T *trypos;
- pos_T *pos;
- static pos_T pos_copy;
+ pos_T cursor_save;
+ pos_T *trypos;
+ pos_T *pos;
+ static pos_T pos_copy;
cursor_save = curwin->w_cursor;
while ((trypos = findmatchlimit(NULL, '{', FM_BLOCKSTOP, 0)) != NULL)
@@ -1652,7 +1652,7 @@ find_start_brace(void) // XXX
&& (pos = ind_find_start_CORS(NULL)) == NULL) // XXX
break;
if (pos != NULL)
- curwin->w_cursor.lnum = pos->lnum;
+ curwin->w_cursor = *pos;
}
curwin->w_cursor = cursor_save;
return trypos;
diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim
index 2cb3f24..2a87460 100644
--- a/src/testdir/test_cindent.vim
+++ b/src/testdir/test_cindent.vim
@@ -5251,4 +5251,16 @@ func Test_cindent_56()
enew! | close
endfunc
+func Test_find_brace_backwards()
+ " this was looking beyond the end of the line
+ new
+ norm R/*
+ norm o0{
+ norm o//
+ norm V{=
+ call assert_equal(['/*', ' 0{', '//'], getline(1, 3))
+ bwipe!
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
--
1.8.3.1

View File

@ -1,45 +0,0 @@
From bd228fd097b41a798f90944b5d1245eddd484142 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 25 Nov 2021 10:50:12 +0000
Subject: [PATCH] patch 8.2.3669: buffer overflow with long help argument
Problem: Buffer overflow with long help argument.
Solution: Use snprintf().
---
src/ex_cmds.c | 3 +--
src/testdir/test_help.vim | 8 ++++++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 45c733b..8f6444f 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5436,8 +5436,7 @@ find_help_tags(
|| (vim_strchr((char_u *)"%_z@", arg[1]) != NULL
&& arg[2] != NUL)))
{
- STRCPY(d, "/\\\\");
- STRCPY(d + 3, arg + 1);
+ vim_snprintf((char *)d, IOSIZE, "/\\\\%s", arg + 1);
// Check for "/\\_$", should be "/\\_\$"
if (d[3] == '_' && d[4] == '$')
STRCPY(d + 4, "\\$");
diff --git a/src/testdir/test_help.vim b/src/testdir/test_help.vim
index 5dd937a..c2aeb1f 100644
--- a/src/testdir/test_help.vim
+++ b/src/testdir/test_help.vim
@@ -55,3 +55,11 @@ func Test_help_local_additions()
call delete('Xruntime', 'rf')
let &rtp = rtp_save
endfunc
+
+func Test_help_long_argument()
+ try
+ exe 'help \%' .. repeat('0', 1021)
+ catch
+ call assert_match("E149:", v:exception)
+ endtry
+endfunc
--
1.8.3.1

View File

@ -1,56 +0,0 @@
From e031fe90cf2e375ce861ff5e5e281e4ad229ebb9 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 5 Dec 2021 12:06:24 +0000
Subject: [PATCH] patch 8.2.3741: using freed memory in open command
Problem: Using freed memory in open command.
Solution: Make a copy of the current line.
Reference:https://github.com/vim/vim/commit/e031fe90cf2e375ce861ff5e5e281e4ad229ebb9
Conflict:src/testdir/test_ex_mode.vim, The current version does not exist and therefore does not fit into this test case
---
src/ex_docmd.c | 10 +++++++---
src/version.c | 2 ++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 203174a..cb6b64a 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -6030,13 +6030,17 @@ ex_open(exarg_T *eap)
regmatch.regprog = vim_regcomp(eap->arg, p_magic ? RE_MAGIC : 0);
if (regmatch.regprog != NULL)
{
+ // make a copy of the line, when searching for a mark it might be
+ // flushed
+ char_u *line = vim_strsave(ml_get_curline());
+
regmatch.rm_ic = p_ic;
- p = ml_get_curline();
- if (vim_regexec(&regmatch, p, (colnr_T)0))
- curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - p);
+ if (vim_regexec(&regmatch, line, (colnr_T)0))
+ curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - line);
else
emsg(_(e_nomatch));
vim_regfree(regmatch.regprog);
+ vim_free(line);
}
// Move to the NUL, ignore any other arguments.
eap->arg += STRLEN(eap->arg);
diff --git a/src/version.c b/src/version.c
index 035c46f..bd45631 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 3741,
/**/
3403,
/**/
--
2.27.0

View File

@ -1,61 +0,0 @@
From 6f98371532fcff911b462d51bc64f2ce8a6ae682 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 24 Dec 2021 18:11:27 +0000
Subject: [PATCH] patch 8.2.3884: crash when clearing the argument list while
using it
Conflict:NA
Reference:https://github.com/vim/vim/commit/6f98371532fcff911b462d51bc64f2ce8a6ae682
Problem: Crash when clearing the argument list while using it.
Solution: Lock the argument list for ":all".
---
src/arglist.c | 3 +++
src/testdir/test_arglist.vim | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/src/arglist.c b/src/arglist.c
index 21c38c1..cdd70ca 100644
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -902,6 +902,7 @@ do_arg_all(
tabpage_T *old_curtab, *last_curtab;
win_T *new_curwin = NULL;
tabpage_T *new_curtab = NULL;
+ int prev_arglist_locked = arglist_locked;
if (ARGCOUNT <= 0)
{
@@ -921,6 +922,7 @@ do_arg_all(
// watch out for its size to be changed.
alist = curwin->w_alist;
++alist->al_refcount;
+ arglist_locked = TRUE;
old_curwin = curwin;
old_curtab = curtab;
@@ -1132,6 +1134,7 @@ do_arg_all(
// Remove the "lock" on the argument list.
alist_unlink(alist);
+ arglist_locked = prev_arglist_locked;
--autocmd_no_enter;
diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim
index c486b18..1c94fe9 100644
--- a/src/testdir/test_arglist.vim
+++ b/src/testdir/test_arglist.vim
@@ -505,3 +505,10 @@ func Test_argdo()
call assert_equal(['Xa.c', 'Xb.c', 'Xc.c'], l)
bwipe Xa.c Xb.c Xc.c
endfunc
+
+func Test_clear_arglist_in_all()
+ n 0 00 000 0000 00000 000000
+ au! * 0 n 0
+ all
+ au! *
+endfunc
--
2.27.0

View File

@ -1,65 +0,0 @@
From 4c13e5e6763c6eb36a343a2b8235ea227202e952 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 30 Dec 2021 14:49:43 +0000
Subject: [PATCH] patch 8.2.3949: using freed memory with /\%V
Conflict:NA
Reference:https://github.com/vim/vim/commit/4c13e5e6763c6eb36a343a2b8235ea227202e952
Problem: Using freed memory with /\%V.
Solution: Get the line again after getvvcol().
---
src/regexp.c | 9 +++++++--
src/testdir/test_regexp_latin.vim | 8 ++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/regexp.c b/src/regexp.c
index 2e94e5a..6849cba 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -1276,9 +1276,9 @@ reg_match_visual(void)
if (lnum < top.lnum || lnum > bot.lnum)
return FALSE;
+ col = (colnr_T)(rex.input - rex.line);
if (mode == 'v')
{
- col = (colnr_T)(rex.input - rex.line);
if ((lnum == top.lnum && col < top.col)
|| (lnum == bot.lnum && col >= bot.col + (*p_sel != 'e')))
return FALSE;
@@ -1293,7 +1293,12 @@ reg_match_visual(void)
end = end2;
if (top.col == MAXCOL || bot.col == MAXCOL)
end = MAXCOL;
- cols = win_linetabsize(wp, rex.line, (colnr_T)(rex.input - rex.line));
+
+ // getvvcol() flushes rex.line, need to get it again
+ rex.line = reg_getline(rex.lnum);
+ rex.input = rex.line + col;
+
+ cols = win_linetabsize(wp, rex.line, col);
if (cols < start || cols > end - (*p_sel == 'e'))
return FALSE;
}
diff --git a/src/testdir/test_regexp_latin.vim b/src/testdir/test_regexp_latin.vim
index 3168edc..044b678 100644
--- a/src/testdir/test_regexp_latin.vim
+++ b/src/testdir/test_regexp_latin.vim
@@ -39,6 +39,14 @@ func Test_recursive_substitute()
bwipe!
endfunc
+func Test_using_visual_position()
+ " this was using freed memory
+ new
+ exe "norm 0o\<Esc>\<C-V>k\<C-X>o0"
+ /\%V
+ bwipe!
+endfunc
+
func Test_nested_backrefs()
" Check example in change.txt.
new
--
2.27.0

View File

@ -1,58 +0,0 @@
From 94f3192b03ed27474db80b4d3a409e107140738b Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 30 Dec 2021 15:29:18 +0000
Subject: [PATCH] patch 8.2.3950: going beyond the end of the line with /\%V
Conflict:NA
Reference:https://github.com/vim/vim/commit/94f3192b03ed27474db80b4d3a409e107140738b
Problem: Going beyond the end of the line with /\%V.
Solution: Check for valid column in getvcol().
---
src/charset.c | 13 +++++++++----
src/testdir/test_regexp_latin.vim | 8 ++++++++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/charset.c b/src/charset.c
index 7505fea..a768c17 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1226,10 +1226,15 @@ getvcol(
posptr = NULL; // continue until the NUL
else
{
- // Special check for an empty line, which can happen on exit, when
- // ml_get_buf() always returns an empty string.
- if (*ptr == NUL)
- pos->col = 0;
+ colnr_T i;
+
+ // In a few cases the position can be beyond the end of the line.
+ for (i = 0; i < pos->col; ++i)
+ if (ptr[i] == NUL)
+ {
+ pos->col = i;
+ break;
+ }
posptr = ptr + pos->col;
if (has_mbyte)
// always start on the first byte
diff --git a/src/testdir/test_regexp_latin.vim b/src/testdir/test_regexp_latin.vim
index 3168edc..4f52bac 100644
--- a/src/testdir/test_regexp_latin.vim
+++ b/src/testdir/test_regexp_latin.vim
@@ -149,3 +149,11 @@ func Test_using_mark_position()
call assert_fails("s/\\%')", 'E486:')
bwipe!
endfunc
+
+func Test_using_invalid_visual_position()
+ " this was going beyond the end of the line
+ new
+ exe "norm 0o000\<Esc>0\<C-V>$s0"
+ /\%V
+ bwipe!
+endfunc
--
2.27.0

View File

@ -1,62 +0,0 @@
From de05bb25733c3319e18dca44e9b59c6ee389eb26 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 13 Jan 2022 13:08:14 +0000
Subject: [PATCH] patch 8.2.4074: going over the end of NameBuff
Problem: Going over the end of NameBuff.
Solution: Check length when appending a space.
---
src/drawscreen.c | 9 +++++----
src/testdir/test_edit.vim | 15 +++++++++++++++
src/version.c | 2 ++
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 9acb705..7425ad4 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -437,12 +437,13 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
p = NameBuff;
len = (int)STRLEN(p);
- if (bt_help(wp->w_buffer)
+ if ((bt_help(wp->w_buffer)
#ifdef FEAT_QUICKFIX
- || wp->w_p_pvw
+ || wp->w_p_pvw
#endif
- || bufIsChanged(wp->w_buffer)
- || wp->w_buffer->b_p_ro)
+ || bufIsChanged(wp->w_buffer)
+ || wp->w_buffer->b_p_ro)
+ && len < MAXPATHL - 1)
*(p + len++) = ' ';
if (bt_help(wp->w_buffer))
{
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index c3b1af5..48e6ff2 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -1532,3 +1532,18 @@ func Test_edit_put_CTRL_E()
set encoding=utf-8
endfunc
+" Weird long file name was going over the end of NameBuff
+func Test_edit_overlong_file_name()
+ CheckUnix
+
+ file 0000000000000000000000000000
+ file %%%%%%%%%%%%%%%%%%%%%%%%%%
+ file %%%%%%
+ set readonly
+ set ls=2
+
+ redraw!
+ set noreadonly ls&
+ bwipe!
+endfunc
+
--
2.23.0

View File

@ -1,109 +0,0 @@
From 9f8c304c8a390ade133bac29963dc8e56ab14cbc Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 17 Jan 2022 17:30:21 +0000
Subject: [PATCH] patch 8.2.4120: block insert goes over the end of the line
Problem: Block insert goes over the end of the line.
Solution: Handle invalid byte better. Fix inserting the wrong text.
---
src/ops.c | 40 ++++++++++++++++++++++++-------------
src/testdir/test_visual.vim | 10 ++++++++++
2 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/src/ops.c b/src/ops.c
index d3e1e47..13e6bdb 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -535,22 +535,27 @@ block_insert(
if (b_insert)
{
off = (*mb_head_off)(oldp, oldp + offset + spaces);
+ spaces -= off;
+ count -= off;
}
else
{
- off = (*mb_off_next)(oldp, oldp + offset);
- offset += off;
+ // spaces fill the gap, the character that's at the edge moves
+ // right
+ off = (*mb_head_off)(oldp, oldp + offset);
+ offset -= off;
}
- spaces -= off;
- count -= off;
}
- newp = alloc(STRLEN(oldp) + s_len + count + 1);
+ // Make sure the allocated size matches what is actually copied below.
+ newp = alloc(STRLEN(oldp) + spaces + s_len
+ + (spaces > 0 && !bdp->is_short ? ts_val - spaces : 0)
+ + count + 1);
if (newp == NULL)
continue;
// copy up to shifted part
- mch_memmove(newp, oldp, (size_t)(offset));
+ mch_memmove(newp, oldp, (size_t)offset);
oldp += offset;
// insert pre-padding
@@ -560,14 +565,21 @@ block_insert(
mch_memmove(newp + offset + spaces, s, (size_t)s_len);
offset += s_len;
- if (spaces && !bdp->is_short)
+ if (spaces > 0 && !bdp->is_short)
{
- // insert post-padding
- vim_memset(newp + offset + spaces, ' ', (size_t)(ts_val - spaces));
- // We're splitting a TAB, don't copy it.
- oldp++;
- // We allowed for that TAB, remember this now
- count++;
+ if (*oldp == TAB)
+ {
+ // insert post-padding
+ vim_memset(newp + offset + spaces, ' ',
+ (size_t)(ts_val - spaces));
+ // we're splitting a TAB, don't copy it
+ oldp++;
+ // We allowed for that TAB, remember this now
+ count++;
+ }
+ else
+ // Not a TAB, no extra spaces
+ count = spaces;
}
if (spaces > 0)
@@ -1609,7 +1621,7 @@ op_insert(oparg_T *oap, long count1)
oap->start_vcol = t;
}
else if (oap->op_type == OP_APPEND
- && oap->end.col + oap->end.coladd
+ && oap->start.col + oap->start.coladd
>= curbuf->b_op_start_orig.col
+ curbuf->b_op_start_orig.coladd)
{
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index 0705fdb..84a8981 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -903,3 +903,13 @@ func Test_visual_block_ctrl_w_f()
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+
+func Test_visual_block_append_invalid_char()
+ " this was going over the end of the line
+ new
+ call setline(1, [' let xxx', 'xxxxxˆ', 'xxxxxxxxxxx'])
+ exe "normal 0\<C-V>jjA-\<Esc>"
+ call assert_equal([' - let xxx', 'xxxxx -ˆ', 'xxxxxxxx-xxx'], getline(1, 3))
+ bwipe!
+endfunc
+
--
2.27.0

View File

@ -1,63 +0,0 @@
From 57df9e8a9f9ae1aafdde9b86b10ad907627a87dc Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 20 Jan 2022 12:10:48 +0000
Subject: [PATCH] patch 8.2.4151: reading beyond the end of a line
Problem: Reading beyond the end of a line.
Solution: For block insert only use the offset for correcting the length.
---
src/ops.c | 20 ++------------------
src/testdir/test_visual.vim | 9 +++++++++
2 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/src/ops.c b/src/ops.c
index 13e6bdb..2122ff3 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -528,24 +528,8 @@ block_insert(
}
if (has_mbyte && spaces > 0)
- {
- int off;
-
- // Avoid starting halfway a multi-byte character.
- if (b_insert)
- {
- off = (*mb_head_off)(oldp, oldp + offset + spaces);
- spaces -= off;
- count -= off;
- }
- else
- {
- // spaces fill the gap, the character that's at the edge moves
- // right
- off = (*mb_head_off)(oldp, oldp + offset);
- offset -= off;
- }
- }
+ // avoid copying part of a multi-byte character
+ offset -= (*mb_head_off)(oldp, oldp + offset);
// Make sure the allocated size matches what is actually copied below.
newp = alloc(STRLEN(oldp) + spaces + s_len
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index 84a8981..3ed927a 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -913,3 +913,12 @@ func Test_visual_block_append_invalid_char()
bwipe!
endfunc
+func Test_visual_block_insert_round_off()
+ new
+ " The number of characters are tuned to fill a 4096 byte allocated block,
+ " so that valgrind reports going over the end.
+ call setline(1, ['xxxxx', repeat('0', 1350), "\t", repeat('x', 60)])
+ exe "normal gg0\<C-V>GI" .. repeat('0', 1320) .. "\<Esc>"
+ bwipe!
+endfunc
+
--
2.27.0

View File

@ -1,65 +0,0 @@
From 05b27615481e72e3b338bb12990fb3e0c2ecc2a9 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 20 Jan 2022 13:32:50 +0000
Subject: [PATCH] patch 8.2.4154: ml_get error when exchanging windows in
Visual mode
Problem: ml_get error when exchanging windows in Visual mode.
Solution: Correct end of Visual area when entering another buffer
Reference:https://github.com/vim/vim/commit/05b27615481e72e3b338bb12990fb3e0c2ecc2a9
Conflict:NA
---
src/testdir/test_visual.vim | 10 ++++++++++
src/window.c | 7 ++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index fcf6473..4f8f056 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -705,6 +705,16 @@ func Test_visual_undo_deletes_last_line()
bwipe!
endfunc
+" this was causing an ml_get error
+func Test_visual_exchange_windows()
+ enew!
+ new
+ call setline(1, ['foo', 'bar'])
+ exe "normal G\<C-V>gg\<C-W>\<C-X>OO\<Esc>"
+ bwipe!
+ bwipe!
+endfunc
+
func Test_visual_mode_put()
new
diff --git a/src/window.c b/src/window.c
index 5b407d5..bb17167 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1661,6 +1661,11 @@ win_exchange(long Prenum)
(void)win_comp_pos(); // recompute window positions
+ if (wp->w_buffer != curbuf)
+ reset_VIsual_and_resel();
+ else if (VIsual_active)
+ wp->w_cursor = curwin->w_cursor;
+
win_enter(wp, TRUE);
redraw_all_later(NOT_VALID);
}
@@ -5114,7 +5119,7 @@ frame_remove(frame_T *frp)
win_alloc_lines(win_T *wp)
{
wp->w_lines_valid = 0;
- wp->w_lines = ALLOC_CLEAR_MULT(wline_T, Rows );
+ wp->w_lines = ALLOC_CLEAR_MULT(wline_T, Rows);
if (wp->w_lines == NULL)
return FAIL;
return OK;
--
2.27.0

View File

@ -1,78 +0,0 @@
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 24 Jan 2022 18:16:12 +0000
Subject: [PATCH] patch 8.2.4206: condition with many "(" causes a crash
Problem: Condition with many "(" causes a crash.
Solution: Limit recursion to 1000.
---
src/eval.c | 12 ++++++++++++
src/globals.h | 2 ++
src/testdir/test_eval_stuff.vim | 5 +++++
3 files changed, 19 insertions(+)
diff --git a/src/eval.c b/src/eval.c
index 3b563f7..95dda90 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2495,6 +2495,7 @@ eval7(
char_u *start_leader, *end_leader;
int ret = OK;
char_u *alias;
+ static int recurse = 0;
/*
* Initialise variable so that clear_tv() can't mistake this for a
@@ -2521,6 +2522,15 @@ eval7(
return FAIL;
}
+ // Limit recursion to 1000 levels. At least at 10000 we run out of stack
+ // and crash.
+ if (recurse == 1000)
+ {
+ semsg(_(e_expression_too_recursive_str), *arg);
+ return FAIL;
+ }
+ ++recurse;
+
switch (**arg)
{
/*
@@ -2761,6 +2771,8 @@ eval7(
*/
if (ret == OK && evaluate && end_leader > start_leader)
ret = eval7_leader(rettv, start_leader, &end_leader);
+
+ --recurse;
return ret;
}
diff --git a/src/globals.h b/src/globals.h
index 75092b7..659bad6 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1464,6 +1464,8 @@ EXTERN char e_endwhile[] INIT(= N_("E170: Missing :endwhile"));
EXTERN char e_endfor[] INIT(= N_("E170: Missing :endfor"));
EXTERN char e_while[] INIT(= N_("E588: :endwhile without :while"));
EXTERN char e_for[] INIT(= N_("E588: :endfor without :for"));
+EXTERN char e_expression_too_recursive_str[]
+ INIT(= N_("E1169: Expression too recursive: %s"));
#endif
EXTERN char e_exists[] INIT(= N_("E13: File exists (add ! to override)"));
EXTERN char e_failed[] INIT(= N_("E472: Command failed"));
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index ec566da..32a5411 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -216,3 +216,8 @@ func Test_scriptversion_fail()
call assert_fails('source Xversionscript', 'E999:')
call delete('Xversionscript')
endfunc
+
+func Test_deep_recursion()
+ " this was running out of stack
+ call assert_fails("exe 'if ' .. repeat('(', 1002)", 'E1169: Expression too recursive: ((')+endfunc
+endfunc
--
1.8.3.1

View File

@ -1,28 +0,0 @@
From 85b6747abc15a7a81086db31289cf1b8b17e6cb1 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 25 Jan 2022 11:55:02 +0000
Subject: [PATCH] patch 8.2.4214: illegal memory access with large 'tabstop' in
Ex mode
Problem: Illegal memory access with large 'tabstop' in Ex mode.
Solution: Allocate enough memory.
---
src/ex_getln.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 769dcb8..68b4757 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -856,7 +856,7 @@ getcmdline_int(
ccline.cmdindent = (firstc > 0 ? indent : 0);
// alloc initial ccline.cmdbuff
- alloc_cmdbuff(exmode_active ? 250 : indent + 1);
+ alloc_cmdbuff(indent + 50);
if (ccline.cmdbuff == NULL)
goto theend; // out of memory
ccline.cmdlen = ccline.cmdpos = 0;
--
1.8.3.1

View File

@ -1,60 +0,0 @@
From dc5490e2cbc8c16022a23b449b48c1bd0083f366 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 25 Jan 2022 13:52:53 +0000
Subject: [PATCH] patch 8.2.4215: illegal memory access when copying lines in
Visual mode
Problem: Illegal memory access when copying lines in Visual mode.
Solution: Adjust the Visual position after copying lines.
---
src/ex_cmds.c | 2 ++
src/testdir/test_visual.vim | 13 +++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index fea6dfa..aa97b40 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -864,6 +864,8 @@ ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
}
appended_lines_mark(n, count);
+ if (VIsual_active)
+ check_pos(curbuf, &VIsual);
msgmore((long)count);
}
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index 3ed927a..f82d75b 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -658,8 +658,6 @@ func Test_linewise_select_mode()
call append('$', ['a', 'b', 'c'])
exe "normal GkkgH\<Del>"
call assert_equal(['', 'b', 'c'], getline(1, '$'))
-
-
" linewise select mode: delete middle two lines
call deletebufline('', 1, '$')
call append('$', ['a', 'b', 'c'])
@@ -681,6 +679,17 @@ func Test_linewise_select_mode()
bwipe!
endfunc
+" this was leaving the end of the Visual area beyond the end of a line
+func Test_visual_ex_copy_line()
+ new
+ call setline(1, ["aaa", "bbbbbbbbbxbb"])
+ /x
+ exe "normal ggvjfxO"
+ t0
+ normal gNU
+ bwipe!
+endfunc
+
func Test_visual_mode_put()
new
--
2.27.0

View File

@ -1,55 +0,0 @@
From 8d02ce1ed75d008c34a5c9aaa51b67cbb9d33baa Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 25 Jan 2022 18:24:00 +0000
Subject: [PATCH] patch 8.2.4217: illegal memory access when undo makes Visual
area invalid
Problem: Illegal memory access when undo makes Visual area invalid.
Solution: Correct the Visual area after undo.
---
src/testdir/test_visual.vim | 15 +++++++++++++++
src/undo.c | 2 ++
2 files changed, 17 insertions(+)
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index f82d75b..fcf6473 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -690,6 +690,21 @@ func Test_visual_ex_copy_line()
bwipe!
endfunc
+" This was leaving the end of the Visual area beyond the end of a line.
+" Set 'undolevels' to start a new undo block.
+func Test_visual_undo_deletes_last_line()
+ new
+ call setline(1, ["aaa", "ccc", "dyd"])
+ set undolevels=100
+ exe "normal obbbbbbbbbxbb\<Esc>"
+ set undolevels=100
+ /y
+ exe "normal ggvjfxO"
+ undo
+ normal gNU
+ bwipe!
+endfunc
+
func Test_visual_mode_put()
new
diff --git a/src/undo.c b/src/undo.c
index 54a6e1c..706dee9 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -2985,6 +2985,8 @@ u_undo_end(
}
}
#endif
+ if (VIsual_active)
+ check_pos(curbuf, &VIsual);
smsg_attr_keep(0, _("%ld %s; %s #%ld %s"),
u_oldcount < 0 ? -u_oldcount : u_oldcount,
--
2.27.0

View File

@ -1,50 +0,0 @@
From 806d037671e133bd28a7864248763f643967973a Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 25 Jan 2022 20:45:16 +0000
Subject: [PATCH] patch 8.2.4218: illegal memory access with bracketed paste in
Ex mode
Problem: Illegal memory access with bracketed paste in Ex mode.
Solution: Reserve space for the trailing NUL.
---
src/edit.c | 3 ++-
src/testdir/test_paste.vim | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/edit.c b/src/edit.c
index c67f67c..3767769 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -4984,7 +4984,8 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
break;
case PASTE_EX:
- if (gap != NULL && ga_grow(gap, idx) == OK)
+ // add one for the NUL that is going to be appended
+ if (gap != NULL && ga_grow(gap, idx + 1) == OK)
{
mch_memmove((char *)gap->ga_data + gap->ga_len,
buf, (size_t)idx);
diff --git a/src/testdir/test_paste.vim b/src/testdir/test_paste.vim
index c30140f..263f084 100644
--- a/src/testdir/test_paste.vim
+++ b/src/testdir/test_paste.vim
@@ -134,3 +134,14 @@ func Test_xrestore()
bwipe!
endfunc
+
+" bracketed paste in Ex-mode
+func Test_paste_ex_mode()
+ unlet! foo
+ call feedkeys("Qlet foo=\"\<Esc>[200~foo\<CR>bar\<Esc>[201~\"\<CR>vi\<CR>", 'xt')
+ call assert_equal("foo\rbar", foo)
+
+
+ " pasting more than 40 bytes
+ exe "norm Q\<PasteStart>0000000000000000000000000000000000000000000000000000000000000000000000\<C-C>"
+endfunc
--
2.27.0

View File

@ -1,92 +0,0 @@
From 06f15416bb8d5636200a10776f1752c4d6e49f31 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 29 Jan 2022 10:51:59 +0000
Subject: [PATCH] patch 8.2.4247: stack corruption when looking for spell
suggestions
Problem: Stack corruption when looking for spell suggestions.
Solution: Prevent the depth increased too much. Add a five second time
limit to finding suggestions.
---
src/spellsuggest.c | 17 +++++++++++++++--
src/testdir/test_spell.vim | 8 ++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/spellsuggest.c b/src/spellsuggest.c
index 8615d52..a73e695 100644
--- a/src/spellsuggest.c
+++ b/src/spellsuggest.c
@@ -1187,7 +1187,7 @@ suggest_try_change(suginfo_T *su)
// Check the maximum score, if we go over it we won't try this change.
#define TRY_DEEPER(su, stack, depth, add) \
- (stack[depth].ts_score + (add) < su->su_maxscore)
+ (depth < MAXWLEN && stack[depth].ts_score + (add) < su->su_maxscore)
/*
* Try finding suggestions by adding/removing/swapping letters.
@@ -1259,6 +1259,9 @@ suggest_trie_walk(
char_u changename[MAXWLEN][80];
#endif
int breakcheckcount = 1000;
+#ifdef FEAT_RELTIME
+ proftime_T time_limit;
+#endif
int compound_ok;
// Go through the whole case-fold tree, try changes at each node.
@@ -1303,6 +1306,11 @@ suggest_trie_walk(
sp->ts_state = STATE_START;
}
}
+#ifdef FEAT_RELTIME
+ // The loop may take an indefinite amount of time. Break out after five
+ // sectonds. TODO: add an option for the time limit.
+ profile_setlimit(5000, &time_limit);
+#endif
// Loop to find all suggestions. At each round we either:
// - For the current state try one operation, advance "ts_curi",
@@ -1337,7 +1345,8 @@ suggest_trie_walk(
// At end of a prefix or at start of prefixtree: check for
// following word.
- if (byts[arridx] == 0 || n == (int)STATE_NOPREFIX)
+ if (depth < MAXWLEN
+ && (byts[arridx] == 0 || n == (int)STATE_NOPREFIX))
{
// Set su->su_badflags to the caps type at this position.
// Use the caps type until here for the prefix itself.
@@ -2630,6 +2639,10 @@ suggest_trie_walk(
{
ui_breakcheck();
breakcheckcount = 1000;
+#ifdef FEAT_RELTIME
+ if (profile_passed_limit(&time_limit))
+ got_int = TRUE;
+#endif
}
}
}
diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim
index e435e91..271d034 100644
--- a/src/testdir/test_spell.vim
+++ b/src/testdir/test_spell.vim
@@ -427,6 +427,14 @@ func Test_spell_long_word()
set nospell
endfunc
+func Test_spellsuggest_too_deep()
+ " This was incrementing "depth" over MAXWLEN.
+ new
+ norm s000G00ý000000000000
+ sil norm ..vzG................vvzG0 v z=
+ bwipe!
+endfunc
+
func LoadAffAndDic(aff_contents, dic_contents)
set enc=latin1
set spellfile=
--
1.8.3.1

View File

@ -1,85 +0,0 @@
From 37f47958b8a2a44abc60614271d9537e7f14e51a Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 29 Jan 2022 14:21:51 +0000
Subject: [PATCH] patch 8.2.4253: using freed memory when substitute with
function call
Problem: Using freed memory when substitute uses a recursive function call.
Solution: Make a copy of the substitute text.
---
src/ex_cmds.c | 19 +++++++++++++++----
src/testdir/test_substitute.vim | 16 ++++++++++++++++
2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index cccdf47..aa97b40 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3577,6 +3577,7 @@ do_sub(exarg_T *eap)
int save_do_all; // remember user specified 'g' flag
int save_do_ask; // remember user specified 'c' flag
char_u *pat = NULL, *sub = NULL; // init for GCC
+ char_u *sub_copy = NULL;
int delimiter;
int sublen;
int got_quit = FALSE;
@@ -3866,11 +3867,20 @@ do_sub(exarg_T *eap)
sub_firstline = NULL;
/*
- * ~ in the substitute pattern is replaced with the old pattern.
- * We do it here once to avoid it to be replaced over and over again.
- * But don't do it when it starts with "\=", then it's an expression.
+ * If the substitute pattern starts with "\=" then it's an expression.
+ * Make a copy, a recursive function may free it.
+ * Otherwise, '~' in the substitute pattern is replaced with the old
+ * pattern. We do it here once to avoid it to be replaced over and over
+ * again.
*/
- if (!(sub[0] == '\\' && sub[1] == '='))
+ if (sub[0] == '\\' && sub[1] == '=')
+ {
+ sub = vim_strsave(sub);
+ if (sub == NULL)
+ return;
+ sub_copy = sub;
+ }
+ else
sub = regtilde(sub, p_magic);
/*
@@ -4670,6 +4680,7 @@ outofmem:
#endif
vim_regfree(regmatch.regprog);
+ vim_free(sub_copy);
// Restore the flag values, they can be used for ":&&".
subflags.do_all = save_do_all;
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index c7532fb..3e6bc5c 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -745,3 +745,19 @@ func Test_sub_beyond_end()
call assert_equal('#', getline(1))
bwipe!
endfunc
+
+" This was using "old_sub" after it was freed.
+func Test_using_old_sub()
+ set compatible maxfuncdepth=10
+ new
+ call setline(1, 'some text.')
+ func Repl()
+ ~
+ s/
+ endfunc
+ silent! s/\%')/\=Repl()
+
+ delfunc Repl
+ bwipe!
+ set nocompatible
+endfunc
--
1.8.3.1

View File

@ -1,117 +0,0 @@
From 652dee448618589de5528a9e9a36995803f5557a Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 28 Jan 2022 20:47:49 +0000
Subject: [PATCH] patch 8.2.4245: ":retab 0" may cause illegal memory access
Problem: ":retab 0" may cause illegal memory access.
Solution: Limit the value of 'tabstop' to 10000.
---
src/indent.c | 4 ++--
src/option.c | 16 +++++++++-------
src/testdir/test_options.vim | 2 ++
src/vim.h | 2 ++
4 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/indent.c b/src/indent.c
index 7d04373..e8e93b9 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -71,7 +71,7 @@ tabstop_set(char_u *var, int **array)
int n = atoi((char *)cp);
// Catch negative values, overflow and ridiculous big values.
- if (n < 0 || n > 9999)
+ if (n < 0 || n > TABSTOP_MAX)
{
semsg(_(e_invarg2), cp);
vim_free(*array);
@@ -1590,7 +1590,7 @@ ex_retab(exarg_T *eap)
emsg(_(e_positive));
return;
}
- if (new_ts < 0 || new_ts > 9999)
+ if (new_ts < 0 || new_ts > TABSTOP_MAX)
{
semsg(_(e_invarg2), eap->arg);
return;
diff --git a/src/option.c b/src/option.c
index e9598d6..382b01b 100644
--- a/src/option.c
+++ b/src/option.c
@@ -3557,6 +3557,11 @@ set_num_option(
errmsg = e_positive;
curbuf->b_p_ts = 8;
}
+ else if (curbuf->b_p_ts > TABSTOP_MAX)
+ {
+ errmsg = e_invalid_argument;
+ curbuf->b_p_ts = 8;
+ }
if (p_tm < 0)
{
errmsg = e_positive;
@@ -5758,7 +5763,7 @@ buf_copy_options(buf_T *buf, int flags)
if (p_vsts && p_vsts != empty_option)
(void)tabstop_set(p_vsts, &buf->b_p_vsts_array);
else
- buf->b_p_vsts_array = 0;
+ buf->b_p_vsts_array = NULL;
buf->b_p_vsts_nopaste = p_vsts_nopaste
? vim_strsave(p_vsts_nopaste) : NULL;
#endif
@@ -6583,9 +6588,7 @@ paste_option_changed(void)
if (buf->b_p_vsts)
free_string_option(buf->b_p_vsts);
buf->b_p_vsts = empty_option;
- if (buf->b_p_vsts_array)
- vim_free(buf->b_p_vsts_array);
- buf->b_p_vsts_array = 0;
+ VIM_CLEAR(buf->b_p_vsts_array);
#endif
}
@@ -6631,12 +6634,11 @@ paste_option_changed(void)
free_string_option(buf->b_p_vsts);
buf->b_p_vsts = buf->b_p_vsts_nopaste
? vim_strsave(buf->b_p_vsts_nopaste) : empty_option;
- if (buf->b_p_vsts_array)
- vim_free(buf->b_p_vsts_array);
+ vim_free(buf->b_p_vsts_array);
if (buf->b_p_vsts && buf->b_p_vsts != empty_option)
(void)tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array);
else
- buf->b_p_vsts_array = 0;
+ buf->b_p_vsts_array = NULL;
#endif
}
diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim
index 65600ee..d4213c1 100644
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -263,6 +263,8 @@ func Test_set_errors()
call assert_fails('set shiftwidth=-1', 'E487:')
call assert_fails('set sidescroll=-1', 'E487:')
call assert_fails('set tabstop=-1', 'E487:')
+ call assert_fails('set tabstop=10000', 'E474:')
+ call assert_fails('set tabstop=5500000000', 'E474:')
call assert_fails('set textwidth=-1', 'E487:')
call assert_fails('set timeoutlen=-1', 'E487:')
call assert_fails('set updatecount=-1', 'E487:')
diff --git a/src/vim.h b/src/vim.h
index 68e2de1..cd917a3 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -2031,6 +2031,8 @@ typedef int sock_T;
#define DICT_MAXNEST 100 // maximum nesting of lists and dicts
+#define TABSTOP_MAX 9999
+
#ifdef FEAT_CLIPBOARD
// VIM_ATOM_NAME is the older Vim-specific selection type for X11. Still
--
2.27.0

View File

@ -1,91 +0,0 @@
From 9b4a80a66544f2782040b641498754bcb5b8d461 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 1 Feb 2022 13:54:17 +0000
Subject: [PATCH] patch 8.2.4281: using freed memory with :lopen and :bwipe
Problem: Using freed memory with :lopen and :bwipe.
Solution: Do not use a wiped out buffer.
---
src/buffer.c | 14 ++++++++++----
src/testdir/test_quickfix.vim | 16 ++++++++++++++++
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/buffer.c b/src/buffer.c
index b4992dd..0f4957d 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1666,6 +1666,7 @@ set_curbuf(buf_T *buf, int action)
#endif
bufref_T newbufref;
bufref_T prevbufref;
+ int valid;
setpcmark();
if (!cmdmod.keepalt)
@@ -1717,13 +1718,19 @@ set_curbuf(buf_T *buf, int action)
// An autocommand may have deleted "buf", already entered it (e.g., when
// it did ":bunload") or aborted the script processing.
// If curwin->w_buffer is null, enter_buffer() will make it valid again
- if ((buf_valid(buf) && buf != curbuf
+ valid = buf_valid(buf);
+ if ((valid && buf != curbuf
#ifdef FEAT_EVAL
&& !aborting()
#endif
) || curwin->w_buffer == NULL)
{
- enter_buffer(buf);
+ // If the buffer is not valid but curwin->w_buffer is NULL we must
+ // enter some buffer. Using the last one is hopefully OK.
+ if (!valid)
+ enter_buffer(lastbuf);
+ else
+ enter_buffer(buf);
#ifdef FEAT_SYN_HL
if (old_tw != curbuf->b_p_tw)
check_colorcolumn(curwin);
@@ -2236,8 +2243,7 @@ free_buf_options(
clear_string_option(&buf->b_p_vsts);
vim_free(buf->b_p_vsts_nopaste);
buf->b_p_vsts_nopaste = NULL;
- vim_free(buf->b_p_vsts_array);
- buf->b_p_vsts_array = NULL;
+ VIM_CLEAR(buf->b_p_vsts_array);
clear_string_option(&buf->b_p_vts);
VIM_CLEAR(buf->b_p_vts_array);
#endif
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index f7c73f4..38a5236 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -876,6 +876,7 @@ func Test_locationlist_curwin_was_closed()
call assert_fails('lrewind', 'E924:')
augroup! testgroup
+ delfunc R
endfunc
func Test_locationlist_cross_tab_jump()
@@ -4674,4 +4675,19 @@ func Test_search_in_dirstack()
call delete('Xtestdir', 'rf')
endfunc
+" Weird sequence of commands that caused entering a wiped-out buffer
+func Test_lopen_bwipe()
+ func R()
+ silent! tab lopen
+ e x
+ silent! lfile
+ endfunc
+
+ cal R()
+ cal R()
+ cal R()
+ bw!
+ delfunc R
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
--
2.27.0

View File

@ -1,113 +0,0 @@
From e3537aec2f8d6470010547af28dcbd83d41461b8 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 8 Feb 2022 15:05:20 +0000
Subject: [PATCH] patch 8.2.4327: may end up with no current buffer
Problem: May end up with no current buffer.
Solution: When deleting the current buffer to not pick a quickfix buffer as
the new current buffer
Reference:https://github.com/vim/vim/commit/e3537aec2f8d6470010547af28dcbd83d41461b8
Conflict:NA
---
src/buffer.c | 26 ++++++++++++++++++++++----
src/testdir/test_quickfix.vim | 25 +++++++++++++++++++++++++
2 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/src/buffer.c b/src/buffer.c
index e5f6a9b..3617c63 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1520,8 +1520,14 @@ do_buffer(
buf = buflist_findnr(curwin->w_jumplist[jumpidx].fmark.fnum);
if (buf != NULL)
{
- if (buf == curbuf || !buf->b_p_bl)
- buf = NULL; // skip current and unlisted bufs
+ // Skip current and unlisted bufs. Also skip a quickfix
+ // buffer, it might be deleted soon.
+ if (buf == curbuf || !buf->b_p_bl
+#if defined(FEAT_QUICKFIX)
+ || bt_quickfix(buf)
+#endif
+ )
+ buf = NULL;
else if (buf->b_ml.ml_mfp == NULL)
{
// skip unloaded buf, but may keep it for later
@@ -1558,7 +1564,11 @@ do_buffer(
continue;
}
// in non-help buffer, try to skip help buffers, and vv
- if (buf->b_help == curbuf->b_help && buf->b_p_bl)
+ if (buf->b_help == curbuf->b_help && buf->b_p_bl
+#if defined(FEAT_QUICKFIX)
+ && !bt_quickfix(buf)
+#endif
+ )
{
if (buf->b_ml.ml_mfp != NULL) // found loaded buffer
break;
@@ -1576,7 +1586,11 @@ do_buffer(
if (buf == NULL) // No loaded buffer, find listed one
{
FOR_ALL_BUFFERS(buf)
- if (buf->b_p_bl && buf != curbuf)
+ if (buf->b_p_bl && buf != curbuf
+#if defined(FEAT_QUICKFIX)
+ && !bt_quickfix(buf)
+#endif
+ )
break;
}
if (buf == NULL) // Still no buffer, just take one
@@ -1585,6 +1599,10 @@ do_buffer(
buf = curbuf->b_next;
else
buf = curbuf->b_prev;
+#if defined(FEAT_QUICKFIX)
+ if (bt_quickfix(buf))
+ buf = NULL;
+#endif
}
}
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index 38a5236..72f3172 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -325,6 +325,31 @@ func Test_copenHeight_tabline()
set tabline& showtabline&
endfunc
+" Another sequence of commands that caused all buffers to be wiped out
+func Test_lopen_bwipe_all()
+ let lines =<< trim END
+ func R()
+ silent! tab lopen
+ e foo
+ silent! lfile
+ endfunc
+ cal R()
+ exe "norm \<C-W>\<C-V>0"
+ cal R()
+ bwipe
+
+ call writefile(['done'], 'Xresult')
+ qall!
+ END
+ call writefile(lines, 'Xscript')
+ if RunVim([], [], '-u NONE -n -X -Z -e -m -s -S Xscript')
+ call assert_equal(['done'], readfile('Xresult'))
+ endif
+
+ call delete('Xscript')
+ call delete('Xresult')
+endfunc
+
" Tests for the :cfile, :lfile, :caddfile, :laddfile, :cgetfile and :lgetfile
" commands.
--
2.27.0

View File

@ -1,66 +0,0 @@
From 6e28703a8e41f775f64e442c5d11ce1ff599aa3f Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 12 Feb 2022 15:42:18 +0000
Subject: [PATCH] patch 8.2.4359: crash when repeatedly using :retab
Problem: crash when repeatedly using :retab.
Solution: Bail out when the line is getting too long.
---
src/indent.c | 5 +++++
src/testdir/test_retab.vim | 20 ++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/src/indent.c b/src/indent.c
index e8e93b9..075802c 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1689,6 +1689,11 @@ ex_retab(exarg_T *eap)
if (ptr[col] == NUL)
break;
vcol += chartabsize(ptr + col, (colnr_T)vcol);
+ if (vcol >= MAXCOL)
+ {
+ emsg(_(e_resulting_text_too_long));
+ break;
+ }
if (has_mbyte)
col += (*mb_ptr2len)(ptr + col);
else
diff --git a/src/testdir/test_retab.vim b/src/testdir/test_retab.vim
index e7b8946..5376f92 100644
--- a/src/testdir/test_retab.vim
+++ b/src/testdir/test_retab.vim
@@ -69,6 +69,8 @@ func Test_retab()
call assert_equal(" a b c ", Retab('!', 3))
call assert_equal(" a b c ", Retab('', 5))
call assert_equal(" a b c ", Retab('!', 5))
+
+ set tabstop& expandtab&
endfunc
func Test_retab_error()
@@ -78,3 +80,21 @@ func Test_retab_error()
call assert_fails('ret 10000', 'E475:')
call assert_fails('ret 80000000000000000000', 'E475:')
endfunc
+
+func Test_retab_endless()
+ new
+ call setline(1, "\t0\t")
+ let caught = 'no'
+ try
+ while 1
+ set ts=4000
+ retab 4
+ endwhile
+ catch /E1240/
+ let caught = 'yes'
+ endtry
+ bwipe!
+ set tabstop&
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
--
2.27.0

View File

@ -1,48 +0,0 @@
From 34f8117dec685ace52cd9e578e2729db278163fc Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Wed, 16 Feb 2022 12:16:19 +0000
Subject: [PATCH] patch 8.2.4397: crash when using many composing characters in
error message
Problem: Crash when using many composing characters in error message.
Solution: Use mb_cptr2char_adv() instead of mb_ptr2char_adv().
---
src/testdir/test_assert.vim | 8 ++++++++
src/testing.c | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim
index 1b1f9e5..1e7d66f 100644
--- a/src/testdir/test_assert.vim
+++ b/src/testdir/test_assert.vim
@@ -45,6 +45,14 @@ func Test_assert_equal()
call assert_equal('XxxxxxxxxxxxxxxxxxxxxxX', 'XyyyyyyyyyyyyyyyyyyyyyyyyyX')
call assert_match("Expected 'X\\\\\\[x occurs 21 times]X' but got 'X\\\\\\[y occurs 25 times]X'", v:errors[0])
call remove(v:errors, 0)
+
+ " many composing characters are handled properly
+ call setline(1, ' ')
+ norm 100gr݀
+ call assert_equal(1, getline(1))
+ call assert_match("Expected 1 but got '.* occurs 100 times]'", v:errors[0])
+ call remove(v:errors, 0)
+ bwipe!
endfunc
func Test_assert_equalfile()
diff --git a/src/testing.c b/src/testing.c
index f879f1e..f19481f 100644
--- a/src/testing.c
+++ b/src/testing.c
@@ -99,7 +99,7 @@ ga_concat_shorten_esc(garray_T *gap, char_u *str)
{
same_len = 1;
s = p;
- c = mb_ptr2char_adv(&s);
+ c = mb_cptr2char_adv(&s);
clen = s - p;
while (*s != NUL && c == mb_ptr2char(s))
{
--
2.27.0

View File

@ -1,85 +0,0 @@
From 5921aeb5741fc6e84c870d68c7c35b93ad0c9f87 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 19 Feb 2022 11:20:12 +0000
Subject: [PATCH] patch 8.2.4418: crash when using special multi-byte character
Problem: Crash when using special multi-byte character.
Solution: Don't use isalpha() for an arbitrary character.
Conflict:
upstream patches:
+ call assert_fails('tc űŤŤŤ¦*', 'E344:')
openEuler patches:
+ call assert_fails('tc űŤŤŤ¦*', 'E472:')
---
src/charset.c | 6 ++++++
src/filepath.c | 2 +-
src/proto/charset.pro | 2 +-
src/testdir/test_autochdir.vim | 7 +++++++
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/charset.c b/src/charset.c
index a768c17..847a01a 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1654,6 +1654,12 @@ vim_isupper(int c)
return isupper(c);
}
+ int
+vim_isalpha(int c)
+{
+ return vim_islower(c) || vim_isupper(c);
+}
+
int
vim_toupper(int c)
{
diff --git a/src/filepath.c b/src/filepath.c
index 01d2dcb..c7f0265 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -3300,7 +3300,7 @@ unix_expandpath(
else if (path_end >= path + wildoff
&& (vim_strchr((char_u *)"*?[{~$", *path_end) != NULL
|| (!p_fic && (flags & EW_ICASE)
- && isalpha(PTR2CHAR(path_end)))))
+ && vim_isalpha(PTR2CHAR(path_end)))))
e = p;
if (has_mbyte)
{
diff --git a/src/proto/charset.pro b/src/proto/charset.pro
index c582a8c..2a928e3 100644
--- a/src/proto/charset.pro
+++ b/src/proto/charset.pro
@@ -47,6 +47,7 @@ int vim_isxdigit(int c);
int vim_isbdigit(int c);
int vim_islower(int c);
int vim_isupper(int c);
+int vim_isalpha(int c);
int vim_toupper(int c);
int vim_tolower(int c);
char_u *skiptowhite(char_u *p);
@@ -59,5 +60,4 @@ int hexhex2nr(char_u *p);
int rem_backslash(char_u *str);
void backslash_halve(char_u *p);
char_u *backslash_halve_save(char_u *p);
-void ebcdic2ascii(char_u *buffer, int len);
/* vim: set ft=c : */
diff --git a/src/testdir/test_autochdir.vim b/src/testdir/test_autochdir.vim
index 1473854..99fc9ae 100644
--- a/src/testdir/test_autochdir.vim
+++ b/src/testdir/test_autochdir.vim
@@ -24,3 +24,10 @@ func Test_set_filename()
call chdir(cwd)
call delete('samples/Xtest')
endfunc
+
+func Test_multibyte()
+ " using an invalid character should not cause a crash
+ set wic
+ call assert_fails('tc űŤŤŤ¦*', 'E472:')
+ set nowic
+endfunc
--
2.27.0

View File

@ -1,51 +0,0 @@
From 4e889f98e95ac05d7c8bd3ee933ab4d47820fdfa Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
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

View File

@ -1,47 +0,0 @@
From 6456fae9ba8e72c74b2c0c499eaf09974604ff30 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 22 Feb 2022 13:37:31 +0000
Subject: [PATCH] patch 8.2.4440: crash with specific regexp pattern and string
Problem: Crash with specific regexp pattern and string.
Solution: Stop at the start of the string.
---
src/regexp_bt.c | 5 +++++
src/testdir/test_regexp_utf8.vim | 7 +++++++
2 files changed, 12 insertions(+)
diff --git a/src/regexp_bt.c b/src/regexp_bt.c
index b71b862..e017ba5 100644
--- a/src/regexp_bt.c
+++ b/src/regexp_bt.c
@@ -4431,6 +4431,11 @@ regmatch(
if (rex.input == rex.line)
{
// backup to last char of previous line
+ if (rex.lnum == 0)
+ {
+ status = RA_NOMATCH;
+ break;
+ }
--rex.lnum;
rex.line = reg_getline(rex.lnum);
// Just in case regrepeat() didn't count
diff --git a/src/testdir/test_regexp_utf8.vim b/src/testdir/test_regexp_utf8.vim
index 6d0ce59..5d1bd47 100644
--- a/src/testdir/test_regexp_utf8.vim
+++ b/src/testdir/test_regexp_utf8.vim
@@ -223,3 +223,10 @@ func Test_match_invalid_byte()
call delete('Xinvalid')
endfunc
+func Test_match_too_complicated()
+ set regexpengine=1
+ exe "vsplit \xeb\xdb\x99"
+ silent! buf \&\zs*\zs*0
+ bwipe!
+ set regexpengine=0
+endfunc
--
2.27.0

View File

@ -1,57 +0,0 @@
From 5c68617d395f9d7b824f68475b24ce3e38d653a3 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 13 Mar 2022 20:12:25 +0000
Subject: [PATCH] patch 8.2.4563: "z=" in Visual mode may go beyond the end of
the line
Problem: "z=" in Visual mode may go beyond the end of the line.
Solution: Adjust "badlen".
---
src/spellsuggest.c | 4 ++++
src/testdir/test_spell.vim | 15 +++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/src/spellsuggest.c b/src/spellsuggest.c
index cd28798..429e292 100644
--- a/src/spellsuggest.c
+++ b/src/spellsuggest.c
@@ -501,6 +501,10 @@ spell_suggest(int count)
curwin->w_cursor.col = VIsual.col;
++badlen;
end_visual_mode();
+ // make sure we don't include the NUL at the end of the line
+ line = ml_get_curline();
+ if (badlen > STRLEN(line) - curwin->w_cursor.col)
+ badlen = STRLEN(line) - curwin->w_cursor.col;
}
// Find the start of the badly spelled word.
else if (spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL) == 0
diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim
index de49b42..49118a9 100644
--- a/src/testdir/test_spell.vim
+++ b/src/testdir/test_spell.vim
@@ -131,6 +131,21 @@ func Test_spellreall()
bwipe!
endfunc
+func Test_spellsuggest_visual_end_of_line()
+ let enc_save = &encoding
+ set encoding=iso8859
+
+ " This was reading beyond the end of the line.
+ norm R00000000000
+ sil norm 0
+ sil! norm i00000)
+ sil! norm i00000)
+ call feedkeys("\<CR>")
+ norm z=
+
+ let &encoding = enc_save
+endfunc
+
func Test_spellinfo()
new
let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
--
2.27.0

View File

@ -1,59 +0,0 @@
From b55986c52d4cd88a22d0b0b0e8a79547ba13e1d5 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 29 Mar 2022 13:24:58 +0100
Subject: [PATCH] patch 8.2.4646: using buffer line after it has been freed
Problem: Using buffer line after it has been freed in old regexp engine.
Solution: After getting mark get the line again.
---
src/regexp_bt.c | 9 +++++++++
src/testdir/test_regexp_latin.vim | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/src/regexp_bt.c b/src/regexp_bt.c
index e017ba5..ff92576 100644
--- a/src/regexp_bt.c
+++ b/src/regexp_bt.c
@@ -3188,8 +3188,17 @@ regmatch(
int mark = OPERAND(scan)[0];
int cmp = OPERAND(scan)[1];
pos_T *pos;
+ size_t col = REG_MULTI ? rex.input - rex.line : 0;
pos = getmark_buf(rex.reg_buf, mark, FALSE);
+
+ // Line may have been freed, get it again.
+ if (REG_MULTI)
+ {
+ rex.line = reg_getline(rex.lnum);
+ rex.input = rex.line + col;
+ }
+
if (pos == NULL // mark doesn't exist
|| pos->lnum <= 0 // mark isn't set in reg_buf
|| (pos->lnum == rex.lnum + rex.reg_firstlnum
diff --git a/src/testdir/test_regexp_latin.vim b/src/testdir/test_regexp_latin.vim
index 5b1db5a..a242d91 100644
--- a/src/testdir/test_regexp_latin.vim
+++ b/src/testdir/test_regexp_latin.vim
@@ -152,10 +152,17 @@ endfunc
func Test_using_mark_position()
" this was using freed memory
+ " new engine
new
norm O0
call assert_fails("s/\\%')", 'E486:')
bwipe!
+
+ " old engine
+ new
+ norm O0
+ call assert_fails("s/\\%#=1\\%')", 'E486:')
+ bwipe!
endfunc
func Test_using_invalid_visual_position()
--
1.8.3.1

View File

@ -1,58 +0,0 @@
From d88934406c5375d88f8f1b65331c9f0cab68cc6c Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 6 May 2022 20:38:47 +0100
Subject: [PATCH] patch 8.2.4895: buffer overflow with invalid command with
composing chars
Problem: Buffer overflow with invalid command with composing chars.
Solution: Check that the whole character fits in the buffer.
---
src/ex_docmd.c | 4 +++-
src/testdir/test_cmdline.vim | 11 +++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index dfcbf37..f142c46 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3092,7 +3092,7 @@ append_command(char_u *cmd)
STRCAT(IObuff, ": ");
d = IObuff + STRLEN(IObuff);
- while (*s != NUL && d - IObuff < IOSIZE - 7)
+ while (*s != NUL && d - IObuff + 5 < IOSIZE)
{
if (enc_utf8 ? (s[0] == 0xc2 && s[1] == 0xa0) : *s == 0xa0)
{
@@ -3100,6 +3100,8 @@ append_command(char_u *cmd)
STRCPY(d, "<a0>");
d += 4;
}
+ else if (d - IObuff + (*mb_ptr2len)(s) + 1 >= IOSIZE)
+ break;
else
MB_COPY_CHAR(s, d);
}
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 5297951..41a73d2 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -870,4 +870,15 @@ func Test_cmdwin_cedit()
delfunc CmdWinType
endfunc
+" this was going over the end of IObuff
+func Test_report_error_with_composing()
+ let caught = 'no'
+ try
+ exe repeat('0', 987) .. "0\xdd\x80\xdd\x80\xdd\x80\xdd\x80"
+ catch /E492:/
+ let caught = 'yes'
+ endtry
+ call assert_equal('yes', caught)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
--
2.27.0

View File

@ -1,53 +0,0 @@
From ef02f16609ff0a26ffc6e20263523424980898fe Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 7 May 2022 10:49:10 +0100
Subject: [PATCH] patch 8.2.4899: with latin1 encoding CTRL-W might go before
the cmdline
Problem: With latin1 encoding CTRL-W might go before the start of the
command line.
Solution: Check already being at the start of the command line.
---
src/ex_getln.c | 11 +++++++----
src/testdir/test_cmdline.vim | 3 +++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 68b4757..771a9cd 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1583,10 +1583,13 @@ getcmdline_int(
{
while (p > ccline.cmdbuff && vim_isspace(p[-1]))
--p;
- i = vim_iswordc(p[-1]);
- while (p > ccline.cmdbuff && !vim_isspace(p[-1])
- && vim_iswordc(p[-1]) == i)
- --p;
+ if (p > ccline.cmdbuff)
+ {
+ i = vim_iswordc(p[-1]);
+ while (p > ccline.cmdbuff && !vim_isspace(p[-1])
+ && vim_iswordc(p[-1]) == i)
+ --p;
+ }
}
else
--p;
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index cbf7986..1ccdbe2 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -476,6 +476,9 @@ func Test_cmdline_remove_char()
call feedkeys(":abc def\<S-Left>\<C-U>\<C-B>\"\<CR>", 'tx')
call assert_equal('"def', @:, e)
+
+ " This was going before the start in latin1.
+ call feedkeys(": \<C-W>\<CR>", 'tx')
endfor
let &encoding = encoding_save
--
1.8.3.1

View File

@ -1,45 +0,0 @@
From 8e4b76da1d7e987d43ca960dfbc372d1c617466f Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 7 May 2022 11:28:06 +0100
Subject: [PATCH] patch 8.2.4901: NULL pointer access when using invalid
pattern
Problem: NULL pointer access when using invalid pattern.
Solution: Check for failed regexp program.
---
src/buffer.c | 2 +-
src/testdir/test_buffer.vim | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/buffer.c b/src/buffer.c
index 5801bce..758d920 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2830,7 +2830,7 @@ fname_match(
rmp->rm_ic = p_fic || ignore_case;
if (vim_regexec(rmp, name, (colnr_T)0))
match = name;
- else
+ else if (rmp->regprog != NULL)
{
// Replace $(HOME) with '~' and try matching again.
p = home_replace_save(NULL, name);
diff --git a/src/testdir/test_buffer.vim b/src/testdir/test_buffer.vim
index dc35bb4..8300f3d 100644
--- a/src/testdir/test_buffer.vim
+++ b/src/testdir/test_buffer.vim
@@ -63,4 +63,11 @@ func Test_bunload_with_offset()
call delete('b4')
endfunc
+" this was using a NULL pointer after failing to use the pattern
+func Test_buf_pattern_invalid()
+ vsplit 0000000
+ silent! buf [0--]\&\zs*\zs*e
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
--
1.8.3.1

View File

@ -1,85 +0,0 @@
From 7c824682d2028432ee082703ef0ab399867a089b Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 8 May 2022 22:32:58 +0100
Subject: [PATCH] patch 8.2.4919: can add invalid bytes with :spellgood
Problem: Can add invalid bytes with :spellgood.
Solution: Check for a valid word string.
---
src/globals.h | 5 +++++
src/mbyte.c | 2 +-
src/spellfile.c | 10 ++++++++++
src/testdir/test_spellfile.vim | 6 ++++++
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/globals.h b/src/globals.h
index 7be3bfd..086d04e 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1745,3 +1745,8 @@ EXTERN int did_repeated_msg INIT(= 0);
# define REPEATED_MSG_LOOKING 1
# define REPEATED_MSG_SAFESTATE 2
#endif
+
+#ifdef FEAT_SPELL
+EXTERN char e_illegal_character_in_word[]
+ INIT(= N_("E1280: Illegal character in word"));
+#endif
diff --git a/src/mbyte.c b/src/mbyte.c
index 5dd2562..28c5e85 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -4045,7 +4045,7 @@ theend:
convert_setup(&vimconv, NULL, NULL);
}
-#if defined(FEAT_GUI_GTK) || defined(PROTO)
+#if defined(FEAT_GUI_GTK) || defined(FEAT_SPELL) || defined(PROTO)
/*
* Return TRUE if string "s" is a valid utf-8 string.
* When "end" is NULL stop at the first NUL.
diff --git a/src/spellfile.c b/src/spellfile.c
index b9451ec..5171572 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -4366,6 +4366,10 @@ store_word(
int res = OK;
char_u *p;
+ // Avoid adding illegal bytes to the word tree.
+ if (enc_utf8 && !utf_valid_string(word, NULL))
+ return FAIL;
+
(void)spell_casefold(word, len, foldword, MAXWLEN);
for (p = pfxlist; res == OK; ++p)
{
@@ -6167,6 +6171,12 @@ spell_add_word(
int i;
char_u *spf;
+ if (enc_utf8 && !utf_valid_string(word, NULL))
+ {
+ emsg(_(e_illegal_character_in_word));
+ return;
+ }
+
if (idx == 0) // use internal wordlist
{
if (int_wordlist == NULL)
diff --git a/src/testdir/test_spellfile.vim b/src/testdir/test_spellfile.vim
index 53eca84..1382c02 100644
--- a/src/testdir/test_spellfile.vim
+++ b/src/testdir/test_spellfile.vim
@@ -170,3 +170,9 @@ func Test_spell_normal()
set spellfile=
bw!
endfunc
+
+" Invalid bytes may cause trouble when creating the word list.
+func Test_check_for_valid_word()
+ call assert_fails("spellgood! 0^B\xac", 'E1280:')
+endfunc
+
--
1.8.3.1

View File

@ -1,56 +0,0 @@
From 53a70289c2712808e6d4e88927e03cac01b470dd Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 9 May 2022 13:15:07 +0100
Subject: [PATCH] patch 8.2.4925: trailing backslash may cause reading past end
of line
Problem: Trailing backslash may cause reading past end of line.
Solution: Check for NUL after backslash.
---
src/search.c | 4 ++++
src/testdir/test_textobjects.vim | 10 +++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/search.c b/src/search.c
index 1a5dc1a..75f0c59 100644
--- a/src/search.c
+++ b/src/search.c
@@ -4457,7 +4457,11 @@ find_next_quote(
if (c == NUL)
return -1;
else if (escape != NULL && vim_strchr(escape, c))
+ {
++col;
+ if (line[col] == NUL)
+ return -1;
+ }
else if (c == quotechar)
break;
if (has_mbyte)
diff --git a/src/testdir/test_textobjects.vim b/src/testdir/test_textobjects.vim
index 49fc9c8..3fc0283 100644
--- a/src/testdir/test_textobjects.vim
+++ b/src/testdir/test_textobjects.vim
@@ -154,10 +154,18 @@ func Test_string_html_objects()
call assert_equal('-<b></b>', getline('.'), e)
set quoteescape&
+
+ " this was going beyond the end of the line
+ %del
+ sil! norm i"\
+ sil! norm i"\
+ sil! norm i"\
+ call assert_equal('"\', getline(1))
+
+ bwipe!
endfor
set enc=utf-8
- bwipe!
endfunc
func Test_empty_html_tag()
--
1.8.3.1

View File

@ -1,44 +0,0 @@
From a59f2dfd0cf9ee1a584d3de5b7c2d47648e79060 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Wed, 11 May 2022 11:42:28 +0100
Subject: [PATCH] patch 8.2.4938: crash when matching buffer with invalid
pattern
Problem: Crash when matching buffer with invalid pattern.
Solution: Check for NULL regprog.
---
src/buffer.c | 2 +-
src/testdir/test_buffer.vim | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/buffer.c b/src/buffer.c
index 758d920..88094ee 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2805,7 +2805,7 @@ buflist_match(
// First try the short file name, then the long file name.
match = fname_match(rmp, buf->b_sfname, ignore_case);
- if (match == NULL)
+ if (match == NULL && rmp->regprog != NULL)
match = fname_match(rmp, buf->b_ffname, ignore_case);
return match;
diff --git a/src/testdir/test_buffer.vim b/src/testdir/test_buffer.vim
index 8300f3d..6039ff8 100644
--- a/src/testdir/test_buffer.vim
+++ b/src/testdir/test_buffer.vim
@@ -68,6 +68,10 @@ func Test_buf_pattern_invalid()
vsplit 0000000
silent! buf [0--]\&\zs*\zs*e
bwipe!
+
+ vsplit 00000000000000000000000000
+ silent! buf [0--]\&\zs*\zs*e
+ bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab
--
1.8.3.1

View File

@ -1,44 +0,0 @@
From 60ae0e71490c97f2871a6344aca61cacf220f813 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 16 May 2022 18:06:15 +0100
Subject: [PATCH] patch 8.2.4968: reading past end of the line when C-indenting
Problem: Reading past end of the line when C-indenting.
Solution: Check for NUL.
---
src/cindent.c | 2 +-
src/testdir/test_cindent.vim | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/cindent.c b/src/cindent.c
index 28d1558..1b2763f 100644
--- a/src/cindent.c
+++ b/src/cindent.c
@@ -91,7 +91,7 @@ skip_string(char_u *p)
while (vim_isdigit(p[i - 1])) // '\000'
++i;
}
- if (p[i] == '\'') // check for trailing '
+ if (p[i - 1] != NUL && p[i] == '\'') // check for trailing '
{
p += i;
continue;
diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim
index 2a87460..3b2200a 100644
--- a/src/testdir/test_cindent.vim
+++ b/src/testdir/test_cindent.vim
@@ -5263,4 +5263,11 @@ func Test_find_brace_backwards()
endfunc
+" This was reading past the end of the line
+func Test_cindent_check_funcdecl()
+ new
+ sil norm o0('\0=L
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
--
1.8.3.1

View File

@ -1,122 +0,0 @@
From 7ce5b2b590256ce53d6af28c1d203fb3bc1d2d97 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 16 May 2022 19:40:59 +0100
Subject: [PATCH] patch 8.2.4969: changing text in Visual mode may cause
invalid memory access
Problem: Changing text in Visual mode may cause invalid memory access.
Solution: Check the Visual position after making a change.
---
src/change.c | 3 +++
src/edit.c | 12 ++----------
src/misc2.c | 25 +++++++++++++++++++++++++
src/proto/misc2.pro | 1 +
src/testdir/test_visual.vim | 10 ++++++++++
5 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/src/change.c b/src/change.c
index f2dfc93..a5ebbdf 100644
--- a/src/change.c
+++ b/src/change.c
@@ -523,6 +523,9 @@ changed_common(
#endif
}
+ if (VIsual_active)
+ check_visual_pos();
+
FOR_ALL_TAB_WINDOWS(tp, wp)
{
if (wp->w_buffer == curbuf)
diff --git a/src/edit.c b/src/edit.c
index f77cc05..0dd6b93 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -3101,16 +3101,8 @@ stop_insert(
// <C-S-Right> may have started Visual mode, adjust the position for
// deleted characters.
- if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum)
- {
- int len = (int)STRLEN(ml_get_curline());
-
- if (VIsual.col > len)
- {
- VIsual.col = len;
- VIsual.coladd = 0;
- }
- }
+ if (VIsual_active)
+ check_visual_pos();
}
}
did_ai = FALSE;
diff --git a/src/misc2.c b/src/misc2.c
index 80731f0..51244da 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -618,6 +618,31 @@ check_cursor(void)
check_cursor_col();
}
+/*
+ * Check if VIsual position is valid, correct it if not.
+ * Can be called when in Visual mode and a change has been made.
+ */
+ void
+check_visual_pos(void)
+{
+ if (VIsual.lnum > curbuf->b_ml.ml_line_count)
+ {
+ VIsual.lnum = curbuf->b_ml.ml_line_count;
+ VIsual.col = 0;
+ VIsual.coladd = 0;
+ }
+ else
+ {
+ int len = (int)STRLEN(ml_get(VIsual.lnum));
+
+ if (VIsual.col > len)
+ {
+ VIsual.col = len;
+ VIsual.coladd = 0;
+ }
+ }
+}
+
#if defined(FEAT_TEXTOBJ) || defined(PROTO)
/*
* Make sure curwin->w_cursor is not on the NUL at the end of the line.
diff --git a/src/proto/misc2.pro b/src/proto/misc2.pro
index a52b462..6e6e22d 100644
--- a/src/proto/misc2.pro
+++ b/src/proto/misc2.pro
@@ -17,6 +17,7 @@ void check_cursor_lnum(void);
void check_cursor_col(void);
void check_cursor_col_win(win_T *win);
void check_cursor(void);
+void check_visual_pos(void);
void adjust_cursor_col(void);
int leftcol_changed(void);
void vim_mem_profile_dump(void);
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index 4f8f056..d21f8f1 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -956,3 +956,13 @@ func Test_visual_block_insert_round_off()
bwipe!
endfunc
+func Test_visual_block_with_substitute()
+ " this was reading beyond the end of the line
+ new
+ norm a0)
+ sil! norm  O
+ s/)
+ sil! norm 
+ bwipe!
+endfunc
+
--
1.8.3.1

View File

@ -1,96 +0,0 @@
From 51f0bfb88a3554ca2dde777d78a59880d1ee37a8 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 17 May 2022 20:11:02 +0100
Subject: [PATCH] patch 8.2.4975: recursive command line loop may cause a crash
Problem: Recursive command line loop may cause a crash.
Solution: Limit recursion of getcmdline().
Reference:https://github.com/vim/vim/commit/51f0bfb88a3554ca2dde777d78a59880d1ee37a8
Conflict:(1)The src/version.c file is not modified
(2)add e_command_too_recursive in src/globals.h
---
src/ex_getln.c | 12 ++++++++++++
src/globals.h | 3 +++
src/testdir/test_cmdline.vim | 12 ++++++++++++
3 files changed, 27 insertions(+)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 771a9cd..e935f78 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -791,6 +791,7 @@ getcmdline_int(
int indent, // indent for inside conditionals
int init_ccline) // clear ccline first
{
+ static int depth = 0; // call depth
int c;
int i;
int j;
@@ -820,6 +821,9 @@ getcmdline_int(
int did_save_ccline = FALSE;
int cmdline_type;
+ // one recursion level deeper
+ ++depth;
+
if (ccline.cmdbuff != NULL)
{
// Being called recursively. Since ccline is global, we need to save
@@ -873,6 +877,13 @@ getcmdline_int(
ccline.cmdlen = indent;
}
+ if (depth == 50)
+ {
+ // Somehow got into a loop recursively calling getcmdline(), bail out.
+ emsg(_(e_command_too_recursive));
+ goto theend;
+ }
+
ExpandInit(&xpc);
ccline.xpc = &xpc;
@@ -2425,6 +2436,7 @@ theend:
{
char_u *p = ccline.cmdbuff;
+ --depth;
if (did_save_ccline)
restore_cmdline(&save_ccline);
else
diff --git a/src/globals.h b/src/globals.h
index 44162d4..e9c88ed 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1747,3 +1747,6 @@ EXTERN int did_repeated_msg INIT(= 0);
EXTERN char e_illegal_character_in_word[]
INIT(= N_("E1280: Illegal character in word"));
#endif
+
+EXTERN char e_command_too_recursive[]
+ INIT(= N_("E169: Command too recursive"));
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 1ccdbe2..b76b7f3 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -903,4 +903,16 @@ func Test_report_error_with_composing()
call assert_equal('yes', caught)
endfunc
+func Test_recursive_register()
+ let @= = ''
+ silent! ?e/
+ let caught = 'no'
+ try
+ normal //
+ catch /E169:/
+ let caught = 'yes'
+ endtry
+ call assert_equal('yes', caught)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
--
2.27.0

View File

@ -1,35 +0,0 @@
From e4463991b2c9243ae93462118b6d6f648852bb0c Mon Sep 17 00:00:00 2001
From: lauk001 <liukuo@kylinos.cn>
Date: Tue, 21 Jun 2022 13:43:57 +0800
Subject: [PATCH] CVE-2022-2124
Signed-off-by: lauk001 <liukuo@kylinos.cn>
---
src/search.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/search.c b/src/search.c
index 75f0c59..87acb33 100644
--- a/src/search.c
+++ b/src/search.c
@@ -4589,11 +4589,17 @@ current_quote(
// Find out if we have a quote in the selection.
while (i <= col_end)
+ {
+ // check for going over the end of the line, which can happen if
+ // the line was changed after the Visual area was selected.
+ if (line[i] == NUL)
+ break;
if (line[i++] == quotechar)
{
selected_quote = TRUE;
break;
}
+ }
}
if (!vis_empty && line[col_start] == quotechar)
--
2.33.0

View File

@ -1,49 +0,0 @@
From 7077892a7918845a00ce8d7833b43cc6cbed2081 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Wed, 5 Feb 2020 20:44:24 +0100
Subject: [PATCH] patch 8.2.0213: configure does not recognize gcc 10.0 and
later
Problem: Configure does not recognize gcc 10.0 and later.
Solution: Adjust the pattern matching the version number. (Sergei
Trofimovich, closes #5580)
---
src/auto/configure | 2 +-
src/configure.ac | 4 ++--
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/auto/configure b/src/auto/configure
index 1b5094e972b2..59f3e68d63cf 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -14762,7 +14762,7 @@ DEPEND_CFLAGS_FILTER=
if test "$GCC" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC 3 or later" >&5
$as_echo_n "checking for GCC 3 or later... " >&6; }
- gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
+ gccmajor=`echo "$gccversion" | sed -e 's/^\([0-9]\+\)\..*$/\1/g'`
if test "$gccmajor" -gt "2"; then
DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
diff --git a/src/configure.ac b/src/configure.ac
index a098da82ec84..bf10eac5511b 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -2195,7 +2195,7 @@ else
fi
dnl On my HPUX system the X include dir is found, but the lib dir not.
- dnl This is a desparate try to fix this.
+ dnl This is a desperate try to fix this.
if test -d "$x_includes" && test ! -d "$x_libraries"; then
x_libraries=`echo "$x_includes" | sed s/include/lib/`
@@ -4447,7 +4447,7 @@ dnl the number before the version number.
DEPEND_CFLAGS_FILTER=
if test "$GCC" = yes; then
AC_MSG_CHECKING(for GCC 3 or later)
- gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
+ gccmajor=`echo "$gccversion" | sed -e 's/^\([[0-9]]\+\)\..*$/\1/g'`
if test "$gccmajor" -gt "2"; then
DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
AC_MSG_RESULT(yes)

View File

@ -1,90 +0,0 @@
From efc0d94afc48a03b07955e91315e7e67945cd079 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 11 Oct 2020 18:05:02 +0200
Subject: [PATCH] patch 8.2.1834: PyEval_InitThreads() is deprecated in Python
3.9
Problem: PyEval_InitThreads() is deprecated in Python 3.9.
Solution: Do not call PyEval_InitThreads in Python 3.9 and later. (Ken
Takata, closes #7113) Avoid warnings for functions.
---
src/if_py_both.h | 8 ++++----
src/if_python3.c | 21 +++++++++++----------
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 0763c65..63f4329 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -306,7 +306,7 @@ ObjectDir(PyObject *self, char **attributes)
// Output buffer management
// Function to write a line, points to either msg() or emsg().
-typedef void (*writefn)(char_u *);
+typedef int (*writefn)(char *);
static PyTypeObject OutputType;
@@ -358,8 +358,8 @@ PythonIO_Flush(void)
{
if (old_fn != NULL && io_ga.ga_len > 0)
{
- ((char_u *)io_ga.ga_data)[io_ga.ga_len] = NUL;
- old_fn((char_u *)io_ga.ga_data);
+ ((char *)io_ga.ga_data)[io_ga.ga_len] = NUL;
+ old_fn((char *)io_ga.ga_data);
}
io_ga.ga_len = 0;
}
@@ -389,7 +389,7 @@ writer(writefn fn, char_u *str, PyInt n)
mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)len);
((char *)io_ga.ga_data)[io_ga.ga_len + len] = NUL;
- fn((char_u *)io_ga.ga_data);
+ fn((char *)io_ga.ga_data);
str = ptr + 1;
n -= len + 1;
io_ga.ga_len = 0;
diff --git a/src/if_python3.c b/src/if_python3.c
index 45dc308..7c9e140 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -958,11 +958,10 @@ Python3_Init(void)
Py_Initialize();
- // Initialise threads, and below save the state using
- // PyEval_SaveThread. Without the call to PyEval_SaveThread, thread
- // specific state (such as the system trace hook), will be lost
- // between invocations of Python code.
+#if PY_VERSION_HEX < 0x03090000
+ // Initialise threads. This is deprecated since Python 3.9.
PyEval_InitThreads();
+#endif
#ifdef DYNAMIC_PYTHON3
get_py3_exceptions();
#endif
@@ -980,12 +979,14 @@ Python3_Init(void)
// sys.path.
PyRun_SimpleString("import vim; import sys; sys.path = list(filter(lambda x: not x.endswith('must>not&exist'), sys.path))");
- // lock is created and acquired in PyEval_InitThreads() and thread
- // state is created in Py_Initialize()
- // there _PyGILState_NoteThreadState() also sets gilcounter to 1
- // (python must have threads enabled!)
- // so the following does both: unlock GIL and save thread state in TLS
- // without deleting thread state
+ // Without the call to PyEval_SaveThread, thread specific state (such
+ // as the system trace hook), will be lost between invocations of
+ // Python code.
+ // GIL may have been created and acquired in PyEval_InitThreads() and
+ // thread state is created in Py_Initialize(); there
+ // _PyGILState_NoteThreadState() also sets gilcounter to 1 (python must
+ // have threads enabled!), so the following does both: unlock GIL and
+ // save thread state in TLS without deleting thread state
PyEval_SaveThread();
py3initialised = 1;
--
1.8.3.1

View File

@ -1,23 +0,0 @@
From a65bb53514a1af1ec0dc5c4831dfaef69f139a48 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Wed, 4 Mar 2020 22:06:07 +0100
Subject: [PATCH] patch 8.2.0354: Python 3.9 does not define _Py_DEC_REFTOTAL
Problem: Python 3.9 does not define _Py_DEC_REFTOTAL. (Zdenek Dohnal)
Solution: Remove it, it was only for debugging.
---
src/if_python3.c | 1 -
1 files changed, 1 deletion(-)
diff --git a/src/if_python3.c b/src/if_python3.c
index 6e4b81acd0e..2985e9c894b 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -603,7 +603,6 @@ static struct
static inline void
py3__Py_DECREF(const char *filename UNUSED, int lineno UNUSED, PyObject *op)
{
- _Py_DEC_REFTOTAL;
if (--op->ob_refcnt != 0)
{
# ifdef Py_REF_DEBUG

View File

@ -1,29 +0,0 @@
From 0e12140550a63bb1e45771edb89b941959440cfe Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 10 Dec 2020 20:50:34 +0100
Subject: [PATCH] patch 8.2.2126: Ruby: missing function prototype
Problem: Ruby: missing function prototype.
Solution: Add the prototype.
---
src/if_ruby.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/if_ruby.c b/src/if_ruby.c
index d0f8acf..906a902 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -492,6 +492,10 @@ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj);
# endif
# endif
+# if RUBY_VERSION >= 26
+void rb_ary_detransient_stub(VALUE x);
+# endif
+
# if (RUBY_VERSION >= 19) && !defined(PROTO)
# if RUBY_VERSION >= 22
long
--
2.13.7

View File

@ -1,173 +0,0 @@
From 5ed58c7b700fcb9fd03c418300145b616f4bdcdd Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 28 Jan 2021 14:24:55 +0100
Subject: [PATCH] patch 8.2.2421: double free when using autocommand with
"argdel"
Conflict:NA
Reference:https://github.com/vim/vim/commit/5ed58c7b700fcb9fd03c418300145b616f4bdcdd
Problem: Double free when using autocommand with "argdel". (Houyunsong)
Solution: Add the arglist_locked flag.
---
src/arglist.c | 47 +++++++++++++++++++++++++++++-------
src/testdir/test_autocmd.vim | 6 +++++
2 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/src/arglist.c b/src/arglist.c
index cab74f8..68befa4 100644
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -17,12 +17,29 @@
#define AL_ADD 2
#define AL_DEL 3
+// This flag is set whenever the argument list is being changed and calling a
+// function that might trigger an autocommand.
+static int arglist_locked = FALSE;
+
+ static int
+check_arglist_locked(void)
+{
+ if (arglist_locked)
+ {
+ emsg(_(e_cannot_change_arglist_recursively));
+ return FAIL;
+ }
+ return OK;
+}
+
/*
* Clear an argument list: free all file names and reset it to zero entries.
*/
void
alist_clear(alist_T *al)
{
+ if (check_arglist_locked() == FAIL)
+ return;
while (--al->al_ga.ga_len >= 0)
vim_free(AARGLIST(al)[al->al_ga.ga_len].ae_fname);
ga_clear(&al->al_ga);
@@ -126,14 +143,9 @@ alist_set(
int fnum_len)
{
int i;
- static int recursive = 0;
- if (recursive)
- {
- emsg(_(e_au_recursive));
+ if (check_arglist_locked() == FAIL)
return;
- }
- ++recursive;
alist_clear(al);
if (ga_grow(&al->al_ga, count) == OK)
@@ -152,7 +164,11 @@ alist_set(
// May set buffer name of a buffer previously used for the
// argument list, so that it's re-used by alist_add.
if (fnum_list != NULL && i < fnum_len)
+ {
+ arglist_locked = TRUE;
buf_set_name(fnum_list[i], files[i]);
+ arglist_locked = FALSE;
+ }
alist_add(al, files[i], use_curbuf ? 2 : 1);
ui_breakcheck();
@@ -163,8 +179,6 @@ alist_set(
FreeWild(count, files);
if (al == &global_alist)
arg_had_last = FALSE;
-
- --recursive;
}
/*
@@ -179,6 +193,10 @@ alist_add(
{
if (fname == NULL) // don't add NULL file names
return;
+ if (check_arglist_locked() == FAIL)
+ return;
+ arglist_locked = TRUE;
+
#ifdef BACKSLASH_IN_FILENAME
slash_adjust(fname);
#endif
@@ -187,6 +205,8 @@ alist_add(
AARGLIST(al)[al->al_ga.ga_len].ae_fnum =
buflist_add(fname, BLN_LISTED | (set_fnum == 2 ? BLN_CURBUF : 0));
++al->al_ga.ga_len;
+
+ arglist_locked = FALSE;
}
#if defined(BACKSLASH_IN_FILENAME) || defined(PROTO)
@@ -334,7 +354,8 @@ alist_add_list(
int i;
int old_argcount = ARGCOUNT;
- if (ga_grow(&ALIST(curwin)->al_ga, count) == OK)
+ if (check_arglist_locked() != FAIL
+ && ga_grow(&ALIST(curwin)->al_ga, count) == OK)
{
if (after < 0)
after = 0;
@@ -343,6 +364,7 @@ alist_add_list(
if (after < ARGCOUNT)
mch_memmove(&(ARGLIST[after + count]), &(ARGLIST[after]),
(ARGCOUNT - after) * sizeof(aentry_T));
+ arglist_locked = TRUE;
for (i = 0; i < count; ++i)
{
int flags = BLN_LISTED | (will_edit ? BLN_CURBUF : 0);
@@ -350,6 +372,7 @@ alist_add_list(
ARGLIST[after + i].ae_fname = files[i];
ARGLIST[after + i].ae_fnum = buflist_add(files[i], flags);
}
+ arglist_locked = FALSE;
ALIST(curwin)->al_ga.ga_len += count;
if (old_argcount > 0 && curwin->w_arg_idx >= after)
curwin->w_arg_idx += count;
@@ -382,6 +405,9 @@ do_arglist(
int match;
int arg_escaped = TRUE;
+ if (check_arglist_locked() == FAIL)
+ return FAIL;
+
// Set default argument for ":argadd" command.
if (what == AL_ADD && *str == NUL)
{
@@ -776,6 +802,9 @@ ex_argdelete(exarg_T *eap)
int i;
int n;
+ if (check_arglist_locked() == FAIL)
+ return;
+
if (eap->addr_count > 0 || *eap->arg == NUL)
{
// ":argdel" works like ":argdel"
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index ab02402..4fa3b51 100755
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -147,6 +147,12 @@ func Test_autocmd_bufunload_with_tabnext()
quit
endfunc
+func Test_argdelete_in_next()
+ au BufNew,BufEnter,BufLeave,BufWinEnter * argdel
+ call assert_fails('next a b', 'E1156:')
+ au! BufNew,BufEnter,BufLeave,BufWinEnter *
+endfunc
+
func Test_autocmd_bufwinleave_with_tabfirst()
tabedit
augroup sample
--
2.27.0

View File

@ -1,50 +0,0 @@
From f5433fbfe4324fd443664fb924116b5ed675bef5 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 21 Jun 2020 20:06:54 +0200
Subject: [PATCH] patch 8.2.1031: build failure with Perl5.32
Problem: Build failure with Perl5.32.
Solution: Define a few more functions. (Felix Yan, closes #6310)
---
src/if_perl.xs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/if_perl.xs b/src/if_perl.xs
index 099d386..5adccce 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -651,6 +651,11 @@ S_SvREFCNT_dec(pTHX_ SV *sv)
}
# endif
+/* perl-5.32 needs Perl_SvREFCNT_dec */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+# define Perl_SvREFCNT_dec S_SvREFCNT_dec
+# endif
+
/* perl-5.26 also needs S_TOPMARK and S_POPMARK. */
# if (PERL_REVISION == 5) && (PERL_VERSION >= 26)
PERL_STATIC_INLINE I32
@@ -675,6 +680,20 @@ S_POPMARK(pTHX)
}
# endif
+/* perl-5.32 needs Perl_POPMARK */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+# define Perl_POPMARK S_POPMARK
+
+/* perl-5.32 needs Perl_SvTRUE */
+PERL_STATIC_INLINE bool
+Perl_SvTRUE(pTHX_ SV *sv) {
+ if (!LIKELY(sv))
+ return FALSE;
+ SvGETMAGIC(sv);
+ return SvTRUE_nomg_NN(sv);
+}
+# endif
+
/*
* Make all runtime-links of perl.
*
--
2.27.0

View File

@ -1,32 +0,0 @@
From 467b59c2eb06f7fe6c2b5b677855cd422adbc45c Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 8 Jan 2021 19:31:39 +0100
Subject: [PATCH] patch 8.2.2312: build failure with Ruby 3.0 and 32 bits
Problem: Build failure with Ruby 3.0 and 32 bits.
Solution: Add #ifdef. (closes #7638)
---
src/if_ruby.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 6522d07..b29f8be 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -596,11 +596,13 @@ rb_check_type_stub(VALUE obj, int t)
{
dll_rb_check_type(obj, t);
}
+# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only
unsigned long
rb_num2uint_stub(VALUE x)
{
return dll_rb_num2uint(x);
}
+# endif
void
ruby_malloc_size_overflow_stub(size_t x, size_t y)
{
--
2.13.7

View File

@ -1,294 +0,0 @@
From dace9f785fca6cc802b2fb7f11a5ee4fab896432 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 28 Dec 2020 15:07:45 +0100
Subject: [PATCH] patch 8.2.2235: build failure with some Ruby versions
Problem: Build failure with some Ruby versions.
Solution: Adjust the code for Ruby 3.0. (Ozaki Kiichi, closes #7564)
---
src/if_ruby.c | 143 ++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 89 insertions(+), 54 deletions(-)
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 906a902..d21a655 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -32,8 +32,9 @@
# define RUBYEXTERN extern
#endif
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 24
-# define USE_RUBY_INTEGER
+// suggested by Ariya Mizutani
+#if (_MSC_VER == 1200)
+# undef _WIN32_WINNT
#endif
#ifdef DYNAMIC_RUBY
@@ -42,6 +43,10 @@
* definition. This function use these variables. But we want function to
* use dll_* variables.
*/
+# if RUBY_VERSION >= 24
+# define USE_RUBY_INTEGER
+# endif
+
# define rb_cFalseClass (*dll_rb_cFalseClass)
# define rb_cFixnum (*dll_rb_cFixnum)
# if defined(USE_RUBY_INTEGER)
@@ -54,6 +59,7 @@
# define rb_cString (*dll_rb_cString)
# define rb_cSymbol (*dll_rb_cSymbol)
# define rb_cTrueClass (*dll_rb_cTrueClass)
+
# if RUBY_VERSION >= 18
/*
* On ver 1.8, all Ruby functions are exported with "__declspec(dllimport)"
@@ -64,40 +70,41 @@
# define RUBY_EXPORT
# endif
-#endif // ifdef DYNAMIC_RUBY
-
-// suggested by Ariya Mizutani
-#if (_MSC_VER == 1200)
-# undef _WIN32_WINNT
-#endif
-
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19
+# if RUBY_VERSION >= 19
// Ruby 1.9 defines a number of static functions which use rb_num2long and
// rb_int2big
-# define rb_num2long rb_num2long_stub
-# define rb_int2big rb_int2big_stub
-#endif
+# define rb_num2long rb_num2long_stub
+# define rb_int2big rb_int2big_stub
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19 \
- && VIM_SIZEOF_INT < VIM_SIZEOF_LONG
+# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
// Ruby 1.9 defines a number of static functions which use rb_fix2int and
// rb_num2int if VIM_SIZEOF_INT < VIM_SIZEOF_LONG (64bit)
-# define rb_fix2int rb_fix2int_stub
-# define rb_num2int rb_num2int_stub
-#endif
+# define rb_fix2int rb_fix2int_stub
+# define rb_num2int rb_num2int_stub
+# endif
+# endif
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION == 21
+# if RUBY_VERSION == 21
// Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses
// rb_gc_writebarrier_unprotect_promoted if USE_RGENGC
-# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub
-#endif
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 22
-# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub
-#endif
+# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub
+# endif
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 26
-# define rb_ary_detransient rb_ary_detransient_stub
-#endif
+# if RUBY_VERSION >= 22
+# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub
+# endif
+
+# if RUBY_VERSION >= 26
+# define rb_ary_detransient rb_ary_detransient_stub
+# endif
+
+# if RUBY_VERSION >= 30
+# define rb_check_type rb_check_type_stub
+# define rb_num2uint rb_num2uint_stub
+# define ruby_malloc_size_overflow ruby_malloc_size_overflow_stub
+# endif
+
+#endif // ifdef DYNAMIC_RUBY
#include <ruby.h>
#if RUBY_VERSION >= 19
@@ -212,7 +219,9 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define rb_assoc_new dll_rb_assoc_new
# define rb_cObject (*dll_rb_cObject)
# define rb_class_new_instance dll_rb_class_new_instance
-# define rb_check_type dll_rb_check_type
+# if RUBY_VERSION < 30
+# define rb_check_type dll_rb_check_type
+# endif
# ifdef USE_TYPEDDATA
# define rb_check_typeddata dll_rb_check_typeddata
# endif
@@ -263,7 +272,9 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define rb_fix2int dll_rb_fix2int
# define rb_num2int dll_rb_num2int
# endif
-# define rb_num2uint dll_rb_num2uint
+# if RUBY_VERSION < 30
+# define rb_num2uint dll_rb_num2uint
+# endif
# endif
# define rb_num2dbl dll_rb_num2dbl
# define rb_lastline_get dll_rb_lastline_get
@@ -481,7 +492,7 @@ static rb_encoding* (*dll_rb_enc_find) (const char*);
static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
static VALUE (*dll_rb_sprintf) (const char*, ...);
static VALUE (*dll_rb_require) (const char*);
-static void* (*ruby_options)(int, char**);
+static void* (*dll_ruby_options)(int, char**);
# endif
# if defined(USE_RGENGC) && USE_RGENGC
@@ -492,32 +503,38 @@ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj);
# endif
# endif
+# if RUBY_VERSION >= 30
+NORETURN(static void (*dll_ruby_malloc_size_overflow)(size_t, size_t));
+# endif
+
# if RUBY_VERSION >= 26
void rb_ary_detransient_stub(VALUE x);
# endif
-# if (RUBY_VERSION >= 19) && !defined(PROTO)
-# if RUBY_VERSION >= 22
+// Do not generate a prototype here, VALUE isn't always defined.
+# ifndef PROTO
+# if RUBY_VERSION >= 19
+# if RUBY_VERSION >= 22
long
rb_num2long_stub(VALUE x)
-# else
+# else
SIGNED_VALUE
rb_num2long_stub(VALUE x)
-# endif
+# endif
{
return dll_rb_num2long(x);
}
-# if RUBY_VERSION >= 26
+# if RUBY_VERSION >= 26
VALUE
rb_int2big_stub(intptr_t x)
-# else
+# else
VALUE
rb_int2big_stub(SIGNED_VALUE x)
-# endif
+# endif
{
return dll_rb_int2big(x);
}
-# if (RUBY_VERSION >= 19) && (VIM_SIZEOF_INT < VIM_SIZEOF_LONG)
+# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG
long
rb_fix2int_stub(VALUE x)
{
@@ -528,50 +545,65 @@ rb_num2int_stub(VALUE x)
{
return dll_rb_num2int(x);
}
-# endif
-# if RUBY_VERSION >= 20
+# endif
+# if RUBY_VERSION >= 20
VALUE
rb_float_new_in_heap(double d)
{
return dll_rb_float_new(d);
}
-# if RUBY_VERSION >= 22
+# if RUBY_VERSION >= 22
unsigned long
rb_num2ulong(VALUE x)
-# else
+# else
VALUE
rb_num2ulong(VALUE x)
-# endif
+# endif
{
return (long)RSHIFT((SIGNED_VALUE)(x),1);
}
+# endif
# endif
-# endif
-
- // Do not generate a prototype here, VALUE isn't always defined.
-# if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO)
-# if RUBY_VERSION == 21
+# if defined(USE_RGENGC) && USE_RGENGC
+# if RUBY_VERSION == 21
void
rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj)
{
dll_rb_gc_writebarrier_unprotect_promoted(obj);
}
-# else
+# else
void
rb_gc_writebarrier_unprotect_stub(VALUE obj)
{
dll_rb_gc_writebarrier_unprotect(obj);
}
+# endif
# endif
-# endif
-
-# if RUBY_VERSION >= 26
+# if RUBY_VERSION >= 26
void
rb_ary_detransient_stub(VALUE x)
{
dll_rb_ary_detransient(x);
}
-# endif
+# endif
+# if RUBY_VERSION >= 30
+ void
+rb_check_type_stub(VALUE obj, int t)
+{
+ dll_rb_check_type(obj, t);
+}
+ unsigned long
+rb_num2uint_stub(VALUE x)
+{
+ return dll_rb_num2uint(x);
+}
+ void
+ruby_malloc_size_overflow_stub(size_t x, size_t y)
+{
+ dll_ruby_malloc_size_overflow(x, y);
+}
+# endif
+# endif // ifndef PROTO
static HINSTANCE hinstRuby = NULL; // Instance of ruby.dll
@@ -728,6 +760,9 @@ static struct
{"rb_gc_writebarrier_unprotect", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect},
# endif
# endif
+# if RUBY_VERSION >= 30
+ {"ruby_malloc_size_overflow", (RUBY_PROC*)&dll_ruby_malloc_size_overflow},
+# endif
{"", NULL},
};
@@ -1823,7 +1858,7 @@ convert_hash2dict(VALUE key, VALUE val, VALUE arg)
dict_T *d = (dict_T *)arg;
dictitem_T *di;
- di = dictitem_alloc((char_u *)RSTRING_PTR(RSTRING(rb_obj_as_string(key))));
+ di = dictitem_alloc((char_u *)RSTRING_PTR(rb_obj_as_string(key)));
if (di == NULL || ruby_convert_to_vim_value(val, &di->di_tv) != OK
|| dict_add(d, di) != OK)
{
--
2.13.7

View File

@ -1,121 +0,0 @@
From d5a986f460019a924627d79350552f446505cffb Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 6 Dec 2020 21:11:31 +0100
Subject: [PATCH] patch 8.2.2104: build problem with Ruby 2.7
Problem: Build problem with Ruby 2.7.
Solution: Adjust function declarations. (Ozaki Kiichi, closes #7430)
---
src/auto/configure | 3 +--
src/configure.ac | 3 +--
src/if_ruby.c | 28 ++++++++++++++++++++--------
3 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/src/auto/configure b/src/auto/configure
index c50f4bc..9a0c1e6 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -7590,8 +7590,7 @@ $as_echo "$rubyhdrdir" >&6; }
librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['LIBRUBYARG'])"`
librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['LIBRUBY_A'])"`
rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['libdir'])"`
- if test -f "$rubylibdir/$librubya"; then
- librubyarg="$librubyarg"
+ if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby"; then
RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
elif test "$librubyarg" = "libruby.a"; then
librubyarg="-lruby"
diff --git a/src/configure.ac b/src/configure.ac
index f0e8371..e796d0e 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -1932,8 +1932,7 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"`
librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"`
rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"`
- if test -f "$rubylibdir/$librubya"; then
- librubyarg="$librubyarg"
+ if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby"; then
RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
elif test "$librubyarg" = "libruby.a"; then
dnl required on Mac OS 10.3 where libruby.a doesn't exist
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 68d5582..d0f8acf 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -1296,13 +1296,19 @@ vim_blob(VALUE self UNUSED, VALUE str)
}
static VALUE
-buffer_s_current(void)
+buffer_s_current(VALUE self UNUSED)
{
return buffer_new(curbuf);
}
static VALUE
-buffer_s_count(void)
+buffer_s_current_getter(ID id UNUSED, VALUE *x UNUSED)
+{
+ return buffer_new(curbuf);
+}
+
+ static VALUE
+buffer_s_count(VALUE self UNUSED)
{
buf_T *b;
int n = 0;
@@ -1562,7 +1568,13 @@ get_win(VALUE obj)
}
static VALUE
-window_s_current(void)
+window_s_current(VALUE self UNUSED)
+{
+ return window_new(curwin);
+}
+
+ static VALUE
+window_s_current_getter(ID id UNUSED, VALUE *x UNUSED)
{
return window_new(curwin);
}
@@ -1572,7 +1584,7 @@ window_s_current(void)
* SegPhault - 03/07/05
*/
static VALUE
-line_s_current(void)
+line_s_current(VALUE self UNUSED)
{
return get_buffer_line(curbuf, curwin->w_cursor.lnum);
}
@@ -1584,13 +1596,13 @@ set_current_line(VALUE self UNUSED, VALUE str)
}
static VALUE
-current_line_number(void)
+current_line_number(VALUE self UNUSED)
{
return INT2FIX((int)curwin->w_cursor.lnum);
}
static VALUE
-window_s_count(void)
+window_s_count(VALUE self UNUSED)
{
win_T *w;
int n = 0;
@@ -1790,8 +1802,8 @@ ruby_vim_init(void)
rb_define_method(cVimWindow, "cursor", window_cursor, 0);
rb_define_method(cVimWindow, "cursor=", window_set_cursor, 1);
- rb_define_virtual_variable("$curbuf", buffer_s_current, 0);
- rb_define_virtual_variable("$curwin", window_s_current, 0);
+ rb_define_virtual_variable("$curbuf", buffer_s_current_getter, 0);
+ rb_define_virtual_variable("$curwin", window_s_current_getter, 0);
}
void
--
2.13.7

View File

@ -1,61 +0,0 @@
From 543467136f001708f4c63376ac5d18adde82db30 Mon Sep 17 00:00:00 2001
From: ichizok <gclient.gaap@gmail.com>
Date: Thu, 27 May 2021 18:05:14 +0200
Subject: [PATCH] patch 8.2.2891: cannot build with Perl 5.34
Problem: Cannot build with Perl 5.34.
Solution: Add Perl_SvTRUE_common(). (Ozaki Kiichi, closes #8266,
closes #8250)
---
src/if_perl.xs | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/if_perl.xs b/src/if_perl.xs
index 99fc3cb..39daa8e 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -692,12 +692,41 @@ S_POPMARK(pTHX)
/* perl-5.32 needs Perl_POPMARK */
# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
# define Perl_POPMARK S_POPMARK
+# endif
+
+/* perl-5.34 needs Perl_SvTRUE_common; used in SvTRUE_nomg_NN */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 34)
+PERL_STATIC_INLINE bool
+Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback)
+{
+ if (UNLIKELY(SvIMMORTAL_INTERP(sv)))
+ return SvIMMORTAL_TRUE(sv);
+
+ if (! SvOK(sv))
+ return FALSE;
+
+ if (SvPOK(sv))
+ return SvPVXtrue(sv);
+
+ if (SvIOK(sv))
+ return SvIVX(sv) != 0; /* casts to bool */
+
+ if (SvROK(sv) && !(SvOBJECT(SvRV(sv)) && HvAMAGIC(SvSTASH(SvRV(sv)))))
+ return TRUE;
+
+ if (sv_2bool_is_fallback)
+ return sv_2bool_nomg(sv);
+
+ return isGV_with_GP(sv);
+}
+# endif
/* perl-5.32 needs Perl_SvTRUE */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
PERL_STATIC_INLINE bool
Perl_SvTRUE(pTHX_ SV *sv) {
if (!LIKELY(sv))
- return FALSE;
+ return FALSE;
SvGETMAGIC(sv);
return SvTRUE_nomg_NN(sv);
}
--
2.27.0

View File

@ -1,48 +0,0 @@
From 895a7a472d2eb4413e63cdad3213cb1ef1633458 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 10 Sep 2020 21:36:11 +0200
Subject: [PATCH] patch 8.2.1655: cannot build with Strawberry Perl 5.32.0
Problem: Cannot build with Strawberry Perl 5.32.0.
Solution: Use Perl_sv_2pvbyte_flags. (closes #6921)
---
src/if_perl.xs | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/if_perl.xs b/src/if_perl.xs
index 2049509..9f59d39 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -236,6 +236,9 @@ typedef int perl_key;
# else
# define Perl_sv_2pv dll_Perl_sv_2pv
# endif
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+# define Perl_sv_2pvbyte_flags dll_Perl_sv_2pvbyte_flags
+# endif
# define Perl_sv_2pvbyte dll_Perl_sv_2pvbyte
# define Perl_sv_bless dll_Perl_sv_bless
# if (PERL_REVISION == 5) && (PERL_VERSION >= 8)
@@ -390,6 +393,9 @@ static char* (*Perl_sv_2pv_nolen)(pTHX_ SV*);
static char* (*Perl_sv_2pv)(pTHX_ SV*, STRLEN*);
# endif
static char* (*Perl_sv_2pvbyte)(pTHX_ SV*, STRLEN*);
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+static char* (*Perl_sv_2pvbyte_flags)(pTHX_ SV*, STRLEN*, I32);
+# endif
static SV* (*Perl_sv_bless)(pTHX_ SV*, HV*);
# if (PERL_REVISION == 5) && (PERL_VERSION >= 8)
static void (*Perl_sv_catpvn_flags)(pTHX_ SV* , const char*, STRLEN, I32);
@@ -546,6 +552,9 @@ static struct {
{"Perl_sv_2pv", (PERL_PROC*)&Perl_sv_2pv},
# endif
{"Perl_sv_2pvbyte", (PERL_PROC*)&Perl_sv_2pvbyte},
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+ {"Perl_sv_2pvbyte_flags", (PERL_PROC*)&Perl_sv_2pvbyte_flags},
+# endif
# ifdef PERL589_OR_LATER
{"Perl_sv_2iv_flags", (PERL_PROC*)&Perl_sv_2iv_flags},
{"Perl_newXS_flags", (PERL_PROC*)&Perl_newXS_flags},
--
2.13.7

View File

@ -1,187 +0,0 @@
From 59cb041d0a56d8555857da7e063ec61504ee1fa7 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Wed, 18 Dec 2019 22:26:31 +0100
Subject: [PATCH] patch 8.2.0023: command line editing not sufficiently tested
Problem: Command line editing not sufficiently tested.
Solution: Add more tests. (Dominique Pelle, closes #5374)
Reference:https://github.com/vim/vim/commit/59cb041d0a56d8555857da7e063ec61504ee1fa7
---
src/testdir/Make_all.mak | 1 +
src/testdir/test_alot.vim | 1 +
src/testdir/test_cmdline.vim | 56 +++++++++++++++++++++++++++++++++-----------
src/testdir/test_ex_mode.vim | 54 ++++++++++++++++++++++++++++++++++++
4 files changed, 98 insertions(+), 14 deletions(-)
create mode 100644 src/testdir/test_ex_mode.vim
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 665bcc7..05e7a2c 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -102,6 +102,7 @@ NEW_TESTS = \
test_ex_equal \
test_ex_undo \
test_ex_z \
+ test_ex_mode \
test_excmd \
test_exec_while_if \
test_execute_func \
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
index 894ec58..25241b2 100644
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -13,6 +13,7 @@ source test_delete.vim
source test_ex_equal.vim
source test_ex_undo.vim
source test_ex_z.vim
+source test_ex_mode.vim
source test_execute_func.vim
source test_expand.vim
source test_expand_dllpath.vim
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 5297951..837ef63 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -419,7 +419,7 @@ func Test_expand_star_star()
call delete('a', 'rf')
endfunc
-func Test_paste_in_cmdline()
+func Test_cmdline_paste()
let @a = "def"
call feedkeys(":abc \<C-R>a ghi\<C-B>\"\<CR>", 'tx')
call assert_equal('"abc def ghi', @:)
@@ -459,18 +459,37 @@ func Test_paste_in_cmdline()
bwipe!
endfunc
-func Test_remove_char_in_cmdline()
- call feedkeys(":abc def\<S-Left>\<Del>\<C-B>\"\<CR>", 'tx')
- call assert_equal('"abc ef', @:)
+func Test_cmdline_remove_char()
+ let encoding_save = &encoding
+
+ for e in ['utf8', 'latin1']
+ exe 'set encoding=' . e
+
+ call feedkeys(":abc def\<S-Left>\<Del>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"abc ef', @:, e)
+
+ call feedkeys(":abc def\<S-Left>\<BS>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"abcdef', @:)
+
+ call feedkeys(":abc def ghi\<S-Left>\<C-W>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"abc ghi', @:, e)
- call feedkeys(":abc def\<S-Left>\<BS>\<C-B>\"\<CR>", 'tx')
- call assert_equal('"abcdef', @:)
+ call feedkeys(":abc def\<S-Left>\<C-U>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"def', @:, e)
+ endfor
+
+ let &encoding = encoding_save
+endfunc
- call feedkeys(":abc def ghi\<S-Left>\<C-W>\<C-B>\"\<CR>", 'tx')
- call assert_equal('"abc ghi', @:)
+func Test_cmdline_keymap_ctrl_hat()
+ if !has('keymap')
+ return
+ endif
- call feedkeys(":abc def\<S-Left>\<C-U>\<C-B>\"\<CR>", 'tx')
- call assert_equal('"def', @:)
+ set keymap=esperanto
+ call feedkeys(":\"Jxauxdo \<C-^>Jxauxdo \<C-^>Jxauxdo\<CR>", 'tx')
+ call assert_equal('"Jxauxdo Ĵaŭdo Jxauxdo', @:)
+ set keymap=
endfunc
func Test_illegal_address1()
@@ -741,20 +760,20 @@ func Test_cmdline_overstrike()
" Test overstrike in the middle of the command line.
call feedkeys(":\"01234\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt')
- call assert_equal('"0ab1cd4', @:)
+ call assert_equal('"0ab1cd4', @:, e)
" Test overstrike going beyond end of command line.
call feedkeys(":\"01234\<home>\<right>\<right>ab\<right>\<insert>cdefgh\<enter>", 'xt')
- call assert_equal('"0ab1cdefgh', @:)
+ call assert_equal('"0ab1cdefgh', @:, e)
" Test toggling insert/overstrike a few times.
call feedkeys(":\"01234\<home>\<right>ab\<right>\<insert>cd\<right>\<insert>ef\<enter>", 'xt')
- call assert_equal('"ab0cd3ef4', @:)
+ call assert_equal('"ab0cd3ef4', @:, e)
endfor
" Test overstrike with multi-byte characters.
call feedkeys(":\"テキストエディタ\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt')
- call assert_equal('"テabキcdエディタ', @:)
+ call assert_equal('"テabキcdエディタ', @:, e)
let &encoding = encoding_save
endfunc
diff --git a/src/testdir/test_ex_mode.vim b/src/testdir/test_ex_mode.vim
new file mode 100644
index 0000000..00a35a3
--- /dev/null
+++ b/src/testdir/test_ex_mode.vim
@@ -0,0 +1,54 @@
+" Test editing line in Ex mode (see :help Q and :help gQ).
+
+" Helper function to test editing line in Q Ex mode
+func Ex_Q(cmd)
+ " Is there a simpler way to test editing Ex line?
+ call feedkeys("Q"
+ \ .. "let s:test_ex =<< END\<CR>"
+ \ .. a:cmd .. "\<CR>"
+ \ .. "END\<CR>"
+ \ .. "visual\<CR>", 'tx')
+ return s:test_ex[0]
+endfunc
+
+" Helper function to test editing line in gQ Ex mode
+func Ex_gQ(cmd)
+ call feedkeys("gQ" .. a:cmd .. "\<C-b>\"\<CR>", 'tx')
+ let ret = @:[1:] " Remove leading quote.
+ call feedkeys("visual\<CR>", 'tx')
+ return ret
+endfunc
+
+" Helper function to test editing line with both Q and gQ Ex mode.
+func Ex(cmd)
+ return [Ex_Q(a:cmd), Ex_gQ(a:cmd)]
+endfunc
+
+" Test editing line in Ex mode (both Q and gQ)
+func Test_ex_mode()
+ let encoding_save = &encoding
+ set sw=2
+
+ for e in ['utf8', 'latin1']
+ exe 'set encoding=' . e
+
+ call assert_equal(['bar', 'bar'], Ex("foo bar\<C-u>bar"), e)
+ call assert_equal(["1\<C-u>2", "1\<C-u>2"], Ex("1\<C-v>\<C-u>2"), e)
+ call assert_equal(["1\<C-b>2\<C-e>3", '213'], Ex("1\<C-b>2\<C-e>3"), e)
+ call assert_equal(['0123', '2013'], Ex("01\<Home>2\<End>3"), e)
+ call assert_equal(['0123', '0213'], Ex("01\<Left>2\<Right>3"), e)
+ call assert_equal(['01234', '0342'], Ex("012\<Left>\<Left>\<Insert>3\<Insert>4"), e)
+ call assert_equal(["foo bar\<C-w>", 'foo '], Ex("foo bar\<C-w>"), e)
+ call assert_equal(['foo', 'foo'], Ex("fooba\<Del>\<Del>"), e)
+ call assert_equal(["foo\tbar", 'foobar'], Ex("foo\<Tab>bar"), e)
+ call assert_equal(["abbrev\t", 'abbreviate'], Ex("abbrev\<Tab>"), e)
+ call assert_equal([' 1', "1\<C-t>\<C-t>"], Ex("1\<C-t>\<C-t>"), e)
+ call assert_equal([' 1', "1\<C-t>\<C-t>"], Ex("1\<C-t>\<C-t>\<C-d>"), e)
+ call assert_equal([' foo', ' foo'], Ex(" foo\<C-d>"), e)
+ call assert_equal(['foo', ' foo0'], Ex(" foo0\<C-d>"), e)
+ call assert_equal(['foo', ' foo^'], Ex(" foo^\<C-d>"), e)
+ endfor
+
+ set sw&
+ let &encoding = encoding_save
+endfunc
--
2.27.0

View File

@ -1,57 +0,0 @@
From 9d20daffc296b9eb901fb14bdd83620ea55d440a Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 1 Feb 2021 19:31:47 +0100
Subject: [PATCH] patch 8.2.2448: compilation error with Ruby 3.0
Problem: Compilation error with Ruby 3.0.
Solution: Adjust #ifdefs and declaration. (Ken Takata, closes #7761)
---
src/if_ruby.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/if_ruby.c b/src/if_ruby.c
index d21a655..6522d07 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -416,7 +416,7 @@ static VALUE (*dll_rb_hash_new) (void);
static VALUE (*dll_rb_inspect) (VALUE);
static VALUE (*dll_rb_int2inum) (long);
static ID (*dll_rb_intern) (const char*);
-# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only
+# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
static long (*dll_rb_fix2int) (VALUE);
static long (*dll_rb_num2int) (VALUE);
static unsigned long (*dll_rb_num2uint) (VALUE);
@@ -504,7 +504,11 @@ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj);
# endif
# if RUBY_VERSION >= 30
+# ifdef _MSC_VER
+static void (*dll_ruby_malloc_size_overflow)(size_t, size_t);
+# else
NORETURN(static void (*dll_ruby_malloc_size_overflow)(size_t, size_t));
+# endif
# endif
# if RUBY_VERSION >= 26
@@ -534,7 +538,7 @@ rb_int2big_stub(SIGNED_VALUE x)
{
return dll_rb_int2big(x);
}
-# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG
+# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
long
rb_fix2int_stub(VALUE x)
{
@@ -673,7 +677,7 @@ static struct
{"rb_inspect", (RUBY_PROC*)&dll_rb_inspect},
{"rb_int2inum", (RUBY_PROC*)&dll_rb_int2inum},
{"rb_intern", (RUBY_PROC*)&dll_rb_intern},
-# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only
+# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
{"rb_fix2int", (RUBY_PROC*)&dll_rb_fix2int},
{"rb_num2int", (RUBY_PROC*)&dll_rb_num2int},
{"rb_num2uint", (RUBY_PROC*)&dll_rb_num2uint},
--
2.13.7

View File

@ -1,38 +0,0 @@
From 23c0192166760b0d73bd39252ca72e3cfe596f6e Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 21 May 2021 11:43:58 +0200
Subject: [PATCH] patch 8.2.2876: configure cannot detect Python 3.10
Problem: Configure cannot detect Python 3.10.
Solution: Use sys.version_info. (closes #8233)
---
src/auto/configure | 2 +-
src/configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/auto/configure b/src/auto/configure
index 0b423a65775..5702a217188 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -6673,7 +6673,7 @@ if ${vi_cv_var_python3_version+:} false; then :
$as_echo_n "(cached) " >&6
else
vi_cv_var_python3_version=`
- ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
+ ${vi_cv_path_python3} -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_var_python3_version" >&5
diff --git a/src/configure.ac b/src/configure.ac
index cc8d61f7f8b..2db04496ff1 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -1436,7 +1436,7 @@ if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic";
dnl -- get its version number
AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
[[vi_cv_var_python3_version=`
- ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
+ ${vi_cv_path_python3} -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
]])
dnl -- it must be at least version 3

View File

@ -1,67 +0,0 @@
From eeed1c7ae090c17f4df51cf97b2a9e4d8b4f4dc7 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 10 Oct 2021 12:35:17 +0100
Subject: [PATCH] patch 8.2.3492: crash when pasting too many times
Problem: Crash when pasting too many times.
Solution: Limit the size to what fits in an int. (closes #8962)
---
src/globals.h | 1 +
src/register.c | 11 +++++++++--
src/testdir/test_put.vim | 8 ++++++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/globals.h b/src/globals.h
index fee8c7f..7be3bfd 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1659,6 +1659,7 @@ EXTERN char e_menuothermode[] INIT(= N_("E328: Menu only exists in another mode"
#endif
EXTERN char e_invalwindow[] INIT(= N_("E957: Invalid window number"));
EXTERN char e_listarg[] INIT(= N_("E686: Argument of %s must be a List"));
+EXTERN char e_resulting_text_too_long[] INIT(= N_("E1240: Resulting text too long"));
#ifdef FEAT_GUI_MAC
EXTERN short disallow_gui INIT(= FALSE);
diff --git a/src/register.c b/src/register.c
index 24e4b99..bab27fe 100644
--- a/src/register.c
+++ b/src/register.c
@@ -1908,8 +1908,15 @@ do_put(
}
do {
- totlen = count * yanklen;
- if (totlen > 0)
+ long multlen = count * yanklen;
+
+ totlen = multlen;
+ if (totlen != multlen)
+ {
+ emsg(_(e_resulting_text_too_long));
+ break;
+ }
+ else if (totlen > 0)
{
oldp = ml_get(lnum);
if (VIsual_active && col > (int)STRLEN(oldp))
diff --git a/src/testdir/test_put.vim b/src/testdir/test_put.vim
index f5037dc..42bb7e6 100644
--- a/src/testdir/test_put.vim
+++ b/src/testdir/test_put.vim
@@ -122,3 +122,11 @@ func Test_put_above_first_line()
call assert_equal('text', getline(1))
bwipe!
endfunc
+
+func Test_very_larg_count()
+ new
+ let @" = 'x'
+ call assert_fails('norm 44444444444444p', 'E1240:')
+ bwipe!
+endfunc
+
--
2.27.0

View File

@ -1,34 +0,0 @@
From e015d99abb4276f47ce97bad1ad5ff0c658b1c8a Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Wed, 17 Nov 2021 19:01:53 +0000
Subject: [PATCH] patch 8.2.3613: :find test fails
Problem: :find test fails.
Solution: Put length check inside if block.
Reference:https://github.com/vim/vim/commit/e015d99abb4276f47ce97bad1ad5ff0c658b1c8a
---
src/findfile.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/findfile.c b/src/findfile.c
index 7a4dfe5..b9a0e47 100644
--- a/src/findfile.c
+++ b/src/findfile.c
@@ -1727,11 +1727,11 @@ find_file_in_path_option(
proc->pr_WindowPtr = (APTR)-1L;
# endif
- if (len == 0)
- return NULL;
-
if (first == TRUE)
{
+ if (len == 0)
+ return NULL;
+
// copy file name into NameBuff, expanding environment variables
save_char = ptr[len];
ptr[len] = NUL;
--
2.23.0

View File

@ -1,50 +0,0 @@
From 679140c56bbabf12a199d94f584b1b9dfc9809fd Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 24 Dec 2021 18:58:46 +0000
Subject: [PATCH] patch 8.2.3885: arglist test fails
Conflict:Abridged some of the notes
Reference:https://github.com/vim/vim/commit/679140c56bbabf12a199d94f584b1b9dfc9809fd
Problem: Arglist test fails.
Solution: Adjust for locking the arglist for ":all".
---
src/testdir/test_arglist.vim | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim
index 7ebe8a2..e5a5e89 100644
--- a/src/testdir/test_arglist.vim
+++ b/src/testdir/test_arglist.vim
@@ -470,15 +470,14 @@ func Test_arglist_autocmd()
new
" redefine arglist; go to Xxx1
next! Xxx1 Xxx2 Xxx3
- " open window for all args
- all
+ " open window for all args; Reading Xxx2 will try to change the arglist and
+ " that will fail
+ call assert_fails("all", "E1156:")
call assert_equal('test file Xxx1', getline(1))
wincmd w
- wincmd w
- call assert_equal('test file Xxx1', getline(1))
- " should now be in Xxx2
- rewind
call assert_equal('test file Xxx2', getline(1))
+ wincmd w
+ call assert_equal('test file Xxx3', getline(1))
autocmd! BufReadPost Xxx2
enew! | only
@@ -515,6 +514,6 @@ endfunc
func Test_clear_arglist_in_all()
n 0 00 000 0000 00000 000000
au! * 0 n 0
- all
+ call assert_fails("all", "E1156")
au! *
endfunc
--
2.27.0

View File

@ -1,94 +0,0 @@
From 7b22117c4ecf383b6f35acef041773a83ec28220 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 17 Aug 2020 19:34:10 +0200
Subject: [PATCH] patch 8.2.1472: ":argdel" does not work like ":.argdel" as
documented
Conflict:NA
Reference:https://github.com/vim/vim/commit/7b22117c4ecf383b6f35acef041773a83ec28220
Problem: ":argdel" does not work like ":.argdel" as documented. (Alexey
Demin)
Solution: Make ":argdel" work like ":.argdel". (closes #6727)
Also fix giving the error "0 more files to edit".
---
src/arglist.c | 18 +++++++++++++-----
src/ex_docmd.c | 2 +-
src/testdir/test_arglist.vim | 10 ++++++++--
3 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/src/arglist.c b/src/arglist.c
index b1a6a0b..cab74f8 100644
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -776,10 +776,20 @@ ex_argdelete(exarg_T *eap)
int i;
int n;
- if (eap->addr_count > 0)
+ if (eap->addr_count > 0 || *eap->arg == NUL)
{
- // ":1,4argdel": Delete all arguments in the range.
- if (eap->line2 > ARGCOUNT)
+ // ":argdel" works like ":argdel"
+ if (eap->addr_count == 0)
+ {
+ if (curwin->w_arg_idx >= ARGCOUNT)
+ {
+ emsg(_("E610: No argument to delete"));
+ return;
+ }
+ eap->line1 = eap->line2 = curwin->w_arg_idx + 1;
+ }
+ else if (eap->line2 > ARGCOUNT)
+ // ":1,4argdel": Delete all arguments in the range.
eap->line2 = ARGCOUNT;
n = eap->line2 - eap->line1 + 1;
if (*eap->arg != NUL)
@@ -808,8 +818,6 @@ ex_argdelete(exarg_T *eap)
curwin->w_arg_idx = ARGCOUNT - 1;
}
}
- else if (*eap->arg == NUL)
- emsg(_(e_argreq));
else
do_arglist(eap->arg, AL_DEL, 0, FALSE);
#ifdef FEAT_TITLE
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index cb6b64a..dfcbf37 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4719,7 +4719,7 @@ check_more(
int n = ARGCOUNT - curwin->w_arg_idx - 1;
if (!forceit && only_one_window()
- && ARGCOUNT > 1 && !arg_had_last && n >= 0 && quitmore == 0)
+ && ARGCOUNT > 1 && !arg_had_last && n > 0 && quitmore == 0)
{
if (message)
{
diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim
index c486b18..3e1e175 100644
--- a/src/testdir/test_arglist.vim
+++ b/src/testdir/test_arglist.vim
@@ -416,9 +416,15 @@ func Test_argdelete()
last
argdelete %
call assert_equal(['b'], argv())
- call assert_fails('argdelete', 'E471:')
+ call assert_fails('argdelete', 'E610:')
call assert_fails('1,100argdelete', 'E16:')
- %argd
+
+ call Reset_arglist()
+ args a b c d
+ next
+ argdel
+ call Assert_argc(['a', 'c', 'd'])
+ %argdel
endfunc
func Test_argdelete_completion()
--
2.27.0

View File

@ -1,164 +0,0 @@
From af631f61bc42d0dddafe1bc0c06872cf3aaeb239 Mon Sep 17 00:00:00 2001
From: Dominique Pelle <dominique.pelle@gmail.com>
Date: Fri, 3 Sep 2021 16:50:16 +0200
Subject: [PATCH] patch 8.2.3398: html text objects are not fully tested
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Problem: Html text objects are not fully tested.
Solution: Add tests for dbcs encoding and different number of backslashes.
(Dominique Pellé, closes #8831)
---
src/testdir/test_textobjects.vim | 135 ++++++++++++++++++++-------------------
1 file changed, 70 insertions(+), 65 deletions(-)
diff --git a/src/testdir/test_textobjects.vim b/src/testdir/test_textobjects.vim
index 042c534..49fc9c8 100644
--- a/src/testdir/test_textobjects.vim
+++ b/src/testdir/test_textobjects.vim
@@ -88,71 +88,76 @@ endfunc
" Tests for string and html text objects
func Test_string_html_objects()
- enew!
-
- let t = '"wo\"rd\\" foo'
- put =t
- normal! da"
- call assert_equal('foo', getline('.'))
-
- let t = "'foo' 'bar' 'piep'"
- put =t
- normal! 0va'a'rx
- call assert_equal("xxxxxxxxxxxx'piep'", getline('.'))
-
- let t = "bla bla `quote` blah"
- put =t
- normal! 02f`da`
- call assert_equal("bla bla blah", getline('.'))
-
- let t = 'out " in "noXno"'
- put =t
- normal! 0fXdi"
- call assert_equal('out " in ""', getline('.'))
-
- let t = "\"'\" 'blah' rep 'buh'"
- put =t
- normal! 03f'vi'ry
- call assert_equal("\"'\" 'blah'yyyyy'buh'", getline('.'))
-
- set quoteescape=+*-
- let t = "bla `s*`d-`+++`l**` b`la"
- put =t
- normal! di`
- call assert_equal("bla `` b`la", getline('.'))
-
- let t = 'voo "nah" sdf " asdf" sdf " sdf" sd'
- put =t
- normal! $F"va"oha"i"rz
- call assert_equal('voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd', getline('.'))
-
- let t = "-<b>asdf<i>Xasdf</i>asdf</b>-"
- put =t
- normal! fXdit
- call assert_equal('-<b>asdf<i></i>asdf</b>-', getline('.'))
-
- let t = "-<b>asdX<i>a<i />sdf</i>asdf</b>-"
- put =t
- normal! 0fXdit
- call assert_equal('-<b></b>-', getline('.'))
-
- let t = "-<b>asdf<i>Xasdf</i>asdf</b>-"
- put =t
- normal! fXdat
- call assert_equal('-<b>asdfasdf</b>-', getline('.'))
-
- let t = "-<b>asdX<i>as<b />df</i>asdf</b>-"
- put =t
- normal! 0fXdat
- call assert_equal('--', getline('.'))
-
- let t = "-<b>\ninnertext object\n</b>"
- put =t
- normal! dit
- call assert_equal('-<b></b>', getline('.'))
-
- set quoteescape&
- enew!
+ for e in ['utf-8', 'latin1', 'cp932']
+ enew!
+ exe 'set enc=' .. e
+
+ let t = '"wo\"rd\\" foo'
+ put =t
+ normal! da"
+ call assert_equal('foo', getline('.'), e)
+
+ let t = "'foo' 'bar' 'piep'"
+ put =t
+ normal! 0va'a'rx
+ call assert_equal("xxxxxxxxxxxx'piep'", getline('.'), e)
+
+ let t = "bla bla `quote` blah"
+ put =t
+ normal! 02f`da`
+ call assert_equal("bla bla blah", getline('.'), e)
+
+ let t = 'out " in "noXno"'
+ put =t
+ normal! 0fXdi"
+ call assert_equal('out " in ""', getline('.'), e)
+
+ let t = "\"'\" 'blah' rep 'buh'"
+ put =t
+ normal! 03f'vi'ry
+ call assert_equal("\"'\" 'blah'yyyyy'buh'", getline('.'), e)
+
+ set quoteescape=+*-
+ let t = "bla `s*`d-`+++`l**` b`la"
+ put =t
+ normal! di`
+ call assert_equal("bla `` b`la", getline('.'), e)
+
+ let t = 'voo "nah" sdf " asdf" sdf " sdf" sd'
+ put =t
+ normal! $F"va"oha"i"rz
+ call assert_equal('voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd', getline('.'), e)
+
+ let t = "-<b>asdf<i>Xasdf</i>asdf</b>-"
+ put =t
+ normal! fXdit
+ call assert_equal('-<b>asdf<i></i>asdf</b>-', getline('.'), e)
+
+ let t = "-<b>asdX<i>a<i />sdf</i>asdf</b>-"
+ put =t
+ normal! 0fXdit
+ call assert_equal('-<b></b>-', getline('.'), e)
+
+ let t = "-<b>asdf<i>Xasdf</i>asdf</b>-"
+ put =t
+ normal! fXdat
+ call assert_equal('-<b>asdfasdf</b>-', getline('.'), e)
+
+ let t = "-<b>asdX<i>as<b />df</i>asdf</b>-"
+ put =t
+ normal! 0fXdat
+ call assert_equal('--', getline('.'), e)
+
+ let t = "-<b>\ninnertext object\n</b>"
+ put =t
+ normal! dit
+ call assert_equal('-<b></b>', getline('.'), e)
+
+ set quoteescape&
+ endfor
+
+ set enc=utf-8
+ bwipe!
endfunc
func Test_empty_html_tag()
--
1.8.3.1

View File

@ -1,109 +0,0 @@
From 9f6277bdde97b7767ded43a0b5a2023eb601b3b7 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 11 Feb 2020 22:04:02 +0100
Subject: [PATCH] patch 8.2.0243: insufficient code coverage for ex_docmd.c
functions
Problem: Insufficient code coverage for ex_docmd.c functions.
Solution: Add more tests. (Yegappan Lakshmanan, closes #5618)
---
src/testdir/Make_all.mak | 2 ++
src/testdir/test_buffer.vim | 66 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+)
create mode 100644 src/testdir/test_buffer.vim
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 05e7a2c..e608b92 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -65,6 +65,7 @@ NEW_TESTS = \
test_blob \
test_blockedit \
test_breakindent \
+ test_buffer \
test_bufline \
test_bufwintabinfo \
test_cd \
@@ -307,6 +308,7 @@ NEW_TESTS_RES = \
test_blob.res \
test_blockedit.res \
test_breakindent.res \
+ test_buffer.res \
test_bufwintabinfo.res \
test_cdo.res \
test_changelist.res \
diff --git a/src/testdir/test_buffer.vim b/src/testdir/test_buffer.vim
new file mode 100644
index 0000000..dc35bb4
--- /dev/null
+++ b/src/testdir/test_buffer.vim
@@ -0,0 +1,66 @@
+" Tests for Vim buffer
+
+" Test for the :bunload command with an offset
+func Test_bunload_with_offset()
+ %bwipe!
+ call writefile(['B1'], 'b1')
+ call writefile(['B2'], 'b2')
+ call writefile(['B3'], 'b3')
+ call writefile(['B4'], 'b4')
+
+ " Load four buffers. Unload the second and third buffers and then
+ " execute .+3bunload to unload the last buffer.
+ edit b1
+ new b2
+ new b3
+ new b4
+
+ bunload b2
+ bunload b3
+ exe bufwinnr('b1') . 'wincmd w'
+ .+3bunload
+ call assert_equal(0, getbufinfo('b4')[0].loaded)
+ call assert_equal('b1',
+ \ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
+
+ " Load four buffers. Unload the third and fourth buffers. Execute .+3bunload
+ " and check whether the second buffer is unloaded.
+ ball
+ bunload b3
+ bunload b4
+ exe bufwinnr('b1') . 'wincmd w'
+ .+3bunload
+ call assert_equal(0, getbufinfo('b2')[0].loaded)
+ call assert_equal('b1',
+ \ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
+
+ " Load four buffers. Unload the second and third buffers and from the last
+ " buffer execute .-3bunload to unload the first buffer.
+ ball
+ bunload b2
+ bunload b3
+ exe bufwinnr('b4') . 'wincmd w'
+ .-3bunload
+ call assert_equal(0, getbufinfo('b1')[0].loaded)
+ call assert_equal('b4',
+ \ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
+
+ " Load four buffers. Unload the first and second buffers. Execute .-3bunload
+ " from the last buffer and check whether the third buffer is unloaded.
+ ball
+ bunload b1
+ bunload b2
+ exe bufwinnr('b4') . 'wincmd w'
+ .-3bunload
+ call assert_equal(0, getbufinfo('b3')[0].loaded)
+ call assert_equal('b4',
+ \ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
+
+ %bwipe!
+ call delete('b1')
+ call delete('b2')
+ call delete('b3')
+ call delete('b4')
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
--
1.8.3.1

View File

@ -1,27 +0,0 @@
From 436b5adc9770a2568209dd5ab1f98bd1afc91898 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 31 Dec 2021 22:49:24 +0000
Subject: [PATCH] patch 8.2.3961: error messages are spread out
Problem: Error messages are spread out.
Solution: Move more errors to errors.h.
---
src/globals.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/globals.h b/src/globals.h
index 75092b7..45d9111 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1453,6 +1453,7 @@ EXTERN char e_abort[] INIT(= N_("E470: Command aborted"));
EXTERN char e_argreq[] INIT(= N_("E471: Argument required"));
EXTERN char e_cannot_change_arglist_recursively[] INIT(= N_("E1156: Cannot change the argument list recursively"));
EXTERN char e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &"));
+EXTERN char e_invalid_argument[] INIT(= N_("E474: Invalid argument"));
#ifdef FEAT_CMDWIN
EXTERN char e_cmdwin[] INIT(= N_("E11: Invalid in command-line window; <CR> executes, CTRL-C quits"));
#endif
--
2.27.0

View File

@ -1,136 +0,0 @@
From ee1b93169d21896e5401a54a5189c9465abb7bc9 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 16 Jul 2020 22:15:53 +0200
Subject: [PATCH] patch 8.2.1225: linker errors when building with dynamic
Python 3.9
Problem: Linker errors when building with dynamic Python 3.9.
Solution: Add #defined items. (closes #6461)
---
src/if_python3.c | 40 +++++++++++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
diff --git a/src/if_python3.c b/src/if_python3.c
index 68da288..45dc308 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -203,6 +203,9 @@ typedef PySliceObject PySliceObject_T;
# define PySys_GetObject py3_PySys_GetObject
# define PySys_SetArgv py3_PySys_SetArgv
# define PyType_Ready py3_PyType_Ready
+# if PY_VERSION_HEX >= 0x030900b0
+# define PyType_GetFlags py3_PyType_GetFlags
+# endif
#undef Py_BuildValue
# define Py_BuildValue py3_Py_BuildValue
# define Py_SetPythonHome py3_Py_SetPythonHome
@@ -233,6 +236,9 @@ typedef PySliceObject PySliceObject_T;
# define PyBytes_FromString py3_PyBytes_FromString
# undef PyBytes_FromStringAndSize
# define PyBytes_FromStringAndSize py3_PyBytes_FromStringAndSize
+# if defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030900b0
+# define _Py_Dealloc py3__Py_Dealloc
+# endif
# define PyFloat_FromDouble py3_PyFloat_FromDouble
# define PyFloat_AsDouble py3_PyFloat_AsDouble
# define PyObject_GenericGetAttr py3_PyObject_GenericGetAttr
@@ -247,7 +253,6 @@ typedef PySliceObject PySliceObject_T;
# ifdef Py_DEBUG
# define _Py_NegativeRefcount py3__Py_NegativeRefcount
# define _Py_RefTotal (*py3__Py_RefTotal)
-# define _Py_Dealloc py3__Py_Dealloc
# define PyModule_Create2TraceRefs py3_PyModule_Create2TraceRefs
# else
# define PyModule_Create2 py3_PyModule_Create2
@@ -287,6 +292,10 @@ typedef PySliceObject PySliceObject_T;
# define PyObject_NEW(type, typeobj) \
( (type *) PyObject_Init( \
(PyObject *) _PyObject_DebugMalloc( _PyObject_SIZE(typeobj) ), (typeobj)) )
+# elif PY_VERSION_HEX >= 0x030900b0
+# undef PyObject_NEW
+# define PyObject_NEW(type, typeobj) \
+ ((type *)py3__PyObject_New(typeobj))
# endif
/*
@@ -352,6 +361,9 @@ static PyObject* (*py3_PyObject_Repr)(PyObject *);
static PyObject* (*py3_PyObject_GetItem)(PyObject *, PyObject *);
static int (*py3_PyObject_IsTrue)(PyObject *);
static PyObject* (*py3_Py_BuildValue)(char *, ...);
+# if PY_VERSION_HEX >= 0x030900b0
+static int (*py3_PyType_GetFlags)(PyTypeObject *o);
+# endif
static int (*py3_PyType_Ready)(PyTypeObject *type);
static int (*py3_PyDict_SetItemString)(PyObject *dp, char *key, PyObject *item);
static PyObject* (*py3_PyUnicode_FromString)(const char *u);
@@ -396,6 +408,12 @@ static char* (*py3_PyBytes_AsString)(PyObject *bytes);
static int (*py3_PyBytes_AsStringAndSize)(PyObject *bytes, char **buffer, Py_ssize_t *length);
static PyObject* (*py3_PyBytes_FromString)(char *str);
static PyObject* (*py3_PyBytes_FromStringAndSize)(char *str, Py_ssize_t length);
+# if defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030900b0
+static void (*py3__Py_Dealloc)(PyObject *obj);
+# endif
+# if PY_VERSION_HEX >= 0x030900b0
+static PyObject* (*py3__PyObject_New)(PyTypeObject *);
+# endif
static PyObject* (*py3_PyFloat_FromDouble)(double num);
static double (*py3_PyFloat_AsDouble)(PyObject *);
static PyObject* (*py3_PyObject_GenericGetAttr)(PyObject *obj, PyObject *name);
@@ -414,7 +432,6 @@ static void* (*py3_PyCapsule_GetPointer)(PyObject *, char *);
# ifdef Py_DEBUG
static void (*py3__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
static Py_ssize_t* py3__Py_RefTotal;
-static void (*py3__Py_Dealloc)(PyObject *obj);
static PyObject* (*py3_PyModule_Create2TraceRefs)(struct PyModuleDef* module, int module_api_version);
# else
static PyObject* (*py3_PyModule_Create2)(struct PyModuleDef* module, int module_api_version);
@@ -525,6 +542,9 @@ static struct
{"PyObject_IsTrue", (PYTHON_PROC*)&py3_PyObject_IsTrue},
{"PyLong_FromLong", (PYTHON_PROC*)&py3_PyLong_FromLong},
{"PyDict_New", (PYTHON_PROC*)&py3_PyDict_New},
+# if PY_VERSION_HEX >= 0x030900b0
+ {"PyType_GetFlags", (PYTHON_PROC*)&py3_PyType_GetFlags},
+# endif
{"PyType_Ready", (PYTHON_PROC*)&py3_PyType_Ready},
{"PyDict_SetItemString", (PYTHON_PROC*)&py3_PyDict_SetItemString},
{"PyLong_AsLong", (PYTHON_PROC*)&py3_PyLong_AsLong},
@@ -562,6 +582,12 @@ static struct
{"PyBytes_AsStringAndSize", (PYTHON_PROC*)&py3_PyBytes_AsStringAndSize},
{"PyBytes_FromString", (PYTHON_PROC*)&py3_PyBytes_FromString},
{"PyBytes_FromStringAndSize", (PYTHON_PROC*)&py3_PyBytes_FromStringAndSize},
+# if defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030900b0
+ {"_Py_Dealloc", (PYTHON_PROC*)&py3__Py_Dealloc},
+# endif
+# if PY_VERSION_HEX >= 0x030900b0
+ {"_PyObject_New", (PYTHON_PROC*)&py3__PyObject_New},
+# endif
{"PyFloat_FromDouble", (PYTHON_PROC*)&py3_PyFloat_FromDouble},
{"PyFloat_AsDouble", (PYTHON_PROC*)&py3_PyFloat_AsDouble},
{"PyObject_GenericGetAttr", (PYTHON_PROC*)&py3_PyObject_GenericGetAttr},
@@ -578,7 +604,6 @@ static struct
# ifdef Py_DEBUG
{"_Py_NegativeRefcount", (PYTHON_PROC*)&py3__Py_NegativeRefcount},
{"_Py_RefTotal", (PYTHON_PROC*)&py3__Py_RefTotal},
- {"_Py_Dealloc", (PYTHON_PROC*)&py3__Py_Dealloc},
{"PyModule_Create2TraceRefs", (PYTHON_PROC*)&py3_PyModule_Create2TraceRefs},
# else
{"PyModule_Create2", (PYTHON_PROC*)&py3_PyModule_Create2},
@@ -634,6 +659,15 @@ py3__Py_XDECREF(PyObject *op)
# define Py_XDECREF(op) py3__Py_XDECREF(_PyObject_CAST(op))
# endif
+# if PY_VERSION_HEX >= 0x030900b0
+ static inline int
+py3_PyType_HasFeature(PyTypeObject *type, unsigned long feature)
+{
+ return ((PyType_GetFlags(type) & feature) != 0);
+}
+# define PyType_HasFeature(t,f) py3_PyType_HasFeature(t,f)
+# endif
+
/*
* Free python.dll
*/
--
1.8.3.1

View File

@ -1,65 +0,0 @@
From 90478f35a8c78e2e10a4b4a8f135998dc04c91fa Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Mon, 14 Jun 2021 15:08:30 +0200
Subject: [PATCH] patch 8.2.2995: linker errors with dynamic Python 3.10
Problem: Linker errors with dynamic Python 3.10.
Solution: Add a couple of library entries. (Zdenek Dohnal, closes #8381,
closes #8356)
---
src/if_python3.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/if_python3.c b/src/if_python3.c
index 7c9e140..72c9e9b 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -181,6 +181,9 @@ typedef PySliceObject PySliceObject_T;
# ifndef PyMapping_Keys
# define PyMapping_Keys py3_PyMapping_Keys
# endif
+# if PY_VERSION_HEX >= 0x030a00b2
+# define PyIter_Check py3_PyIter_Check
+# endif
# define PyIter_Next py3_PyIter_Next
# define PyObject_GetIter py3_PyObject_GetIter
# define PyObject_Repr py3_PyObject_Repr
@@ -355,6 +358,9 @@ static PyObject* (*py3_PyDict_GetItemString)(PyObject *, const char *);
static int (*py3_PyDict_Next)(PyObject *, Py_ssize_t *, PyObject **, PyObject **);
static PyObject* (*py3_PyLong_FromLong)(long);
static PyObject* (*py3_PyDict_New)(void);
+# if PY_VERSION_HEX >= 0x030a00b2
+static int (*py3_PyIter_Check)(PyObject *o);
+# endif
static PyObject* (*py3_PyIter_Next)(PyObject *);
static PyObject* (*py3_PyObject_GetIter)(PyObject *);
static PyObject* (*py3_PyObject_Repr)(PyObject *);
@@ -535,6 +541,9 @@ static struct
{"PyDict_Next", (PYTHON_PROC*)&py3_PyDict_Next},
{"PyMapping_Check", (PYTHON_PROC*)&py3_PyMapping_Check},
{"PyMapping_Keys", (PYTHON_PROC*)&py3_PyMapping_Keys},
+# if PY_VERSION_HEX >= 0x030a00b2
+ {"PyIter_Check", (PYTHON_PROC*)&py3_PyIter_Check},
+# endif
{"PyIter_Next", (PYTHON_PROC*)&py3_PyIter_Next},
{"PyObject_GetIter", (PYTHON_PROC*)&py3_PyObject_GetIter},
{"PyObject_Repr", (PYTHON_PROC*)&py3_PyObject_Repr},
@@ -668,6 +677,15 @@ py3_PyType_HasFeature(PyTypeObject *type, unsigned long feature)
# define PyType_HasFeature(t,f) py3_PyType_HasFeature(t,f)
# endif
+# if PY_VERSION_HEX >= 0x030a00b2
+ static inline int
+py3__PyObject_TypeCheck(PyObject *ob, PyTypeObject *type)
+{
+ return Py_IS_TYPE(ob, type) || PyType_IsSubtype(Py_TYPE(ob), type);
+}
+# define _PyObject_TypeCheck(o,t) py3__PyObject_TypeCheck(o,t)
+# endif
+
/*
* Free python.dll
*/
--
1.8.3.1

View File

@ -1,642 +0,0 @@
From 41a4141ecb36cd871c6e87f6fbc12fa81653b6be Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 7 Jan 2020 21:32:19 +0100
Subject: [PATCH] patch 8.2.0100: macros for Ruby are too complicated
Problem: Macros for Ruby are too complicated.
Solution: Do not use DYNAMIC_RUBY_VER, use RUBY_VERSION. (Ken Takata,
closes #5452)
---
src/Make_cyg_ming.mak | 3 -
src/Make_mvc.mak | 5 +-
src/auto/configure | 2 +-
src/configure.ac | 2 +-
src/if_ruby.c | 164 +++++++++++++++++++++---------------------
5 files changed, 86 insertions(+), 90 deletions(-)
diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak
index 3c878cbfb..f9c795bfe 100644
--- a/src/Make_cyg_ming.mak
+++ b/src/Make_cyg_ming.mak
@@ -569,11 +569,8 @@ ifdef RUBY
CFLAGS += -DFEAT_RUBY $(RUBYINC)
ifeq (yes, $(DYNAMIC_RUBY))
CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
-CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
endif
- ifeq (no, $(DYNAMIC_RUBY))
CFLAGS += -DRUBY_VERSION=$(RUBY_VER)
- endif
ifneq ($(findstring w64-mingw32,$(CC)),)
# A workaround for MinGW-w64
CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 8694f7496..eb7129614 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -1193,10 +1193,11 @@ RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
# Do we want to load Ruby dynamically?
! if "$(DYNAMIC_RUBY)" == "yes"
! message Ruby DLL will be loaded dynamically
-CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=$(RUBY_VER) \
- -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
+CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY \
+ -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
! undef RUBY_LIB
! endif
+CFLAGS = $(CFLAGS) -DRUBY_VERSION=$(RUBY_VER)
!endif # RUBY
#
diff --git a/src/auto/configure b/src/auto/configure
index 993049573..1b5094e97 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -7622,7 +7622,7 @@ $as_echo "$rubyhdrdir" >&6; }
fi
$as_echo "#define DYNAMIC_RUBY 1" >>confdefs.h
- RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
+ RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" $RUBY_CFLAGS"
RUBY_LIBS=
fi
else
diff --git a/src/configure.ac b/src/configure.ac
index d440a465c..a098da82e 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -1966,7 +1966,7 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"`
fi
AC_DEFINE(DYNAMIC_RUBY)
- RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
+ RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" $RUBY_CFLAGS"
RUBY_LIBS=
fi
else
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 00783c8d7..68d55821f 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -20,7 +20,7 @@
#include <string.h>
#ifdef _WIN32
-# if !defined(DYNAMIC_RUBY_VER) || (DYNAMIC_RUBY_VER < 18)
+# if !defined(DYNAMIC_RUBY) || (RUBY_VERSION < 18)
# define NT
# endif
# ifndef DYNAMIC_RUBY
@@ -32,7 +32,7 @@
# define RUBYEXTERN extern
#endif
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 24
+#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 24
# define USE_RUBY_INTEGER
#endif
@@ -47,14 +47,14 @@
# if defined(USE_RUBY_INTEGER)
# define rb_cInteger (*dll_rb_cInteger)
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20
+# if RUBY_VERSION >= 20
# define rb_cFloat (*dll_rb_cFloat)
# endif
# define rb_cNilClass (*dll_rb_cNilClass)
# define rb_cString (*dll_rb_cString)
# define rb_cSymbol (*dll_rb_cSymbol)
# define rb_cTrueClass (*dll_rb_cTrueClass)
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
/*
* On ver 1.8, all Ruby functions are exported with "__declspec(dllimport)"
* in ruby.h. But it causes trouble for these variables, because it is
@@ -71,29 +71,14 @@
# undef _WIN32_WINNT
#endif
-#if (defined(RUBY_VERSION) && RUBY_VERSION >= 19) \
- || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19)
-# define RUBY19_OR_LATER 1
-#endif
-
-#if (defined(RUBY_VERSION) && RUBY_VERSION >= 20) \
- || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20)
-# define RUBY20_OR_LATER 1
-#endif
-
-#if (defined(RUBY_VERSION) && RUBY_VERSION >= 21) \
- || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21)
-# define RUBY21_OR_LATER 1
-#endif
-
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
+#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19
// Ruby 1.9 defines a number of static functions which use rb_num2long and
// rb_int2big
# define rb_num2long rb_num2long_stub
# define rb_int2big rb_int2big_stub
#endif
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 \
+#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19 \
&& VIM_SIZEOF_INT < VIM_SIZEOF_LONG
// Ruby 1.9 defines a number of static functions which use rb_fix2int and
// rb_num2int if VIM_SIZEOF_INT < VIM_SIZEOF_LONG (64bit)
@@ -101,24 +86,24 @@
# define rb_num2int rb_num2int_stub
#endif
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
+#if defined(DYNAMIC_RUBY) && RUBY_VERSION == 21
// Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses
// rb_gc_writebarrier_unprotect_promoted if USE_RGENGC
# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub
#endif
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
+#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 22
# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub
#endif
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26
+#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 26
# define rb_ary_detransient rb_ary_detransient_stub
#endif
#include <ruby.h>
-#ifdef RUBY19_OR_LATER
+#if RUBY_VERSION >= 19
# include <ruby/encoding.h>
#endif
-#ifndef RUBY19_OR_LATER
+#if RUBY_VERSION <= 18
# include <st.h> // for ST_STOP and ST_CONTINUE
#endif
@@ -139,7 +124,7 @@
* The old Data_XXX macro family was deprecated on Ruby 2.2.
* Use TypedData_XXX if available.
*/
-#if defined(TypedData_Wrap_Struct) && defined(RUBY20_OR_LATER)
+#if defined(TypedData_Wrap_Struct) && (RUBY_VERSION >= 20)
# define USE_TYPEDDATA 1
#endif
@@ -210,7 +195,7 @@ static void ruby_io_init(void);
static void ruby_vim_init(void);
static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
-#if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
+#if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
# if defined(__ia64) && !defined(ruby_init_stack)
# define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp())
# endif
@@ -233,7 +218,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# endif
# define rb_class_path dll_rb_class_path
# ifdef USE_TYPEDDATA
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23
+# if RUBY_VERSION >= 23
# define rb_data_typed_object_wrap dll_rb_data_typed_object_wrap
# else
# define rb_data_typed_object_alloc dll_rb_data_typed_object_alloc
@@ -256,7 +241,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define rb_eRuntimeError (*dll_rb_eRuntimeError)
# define rb_eStandardError (*dll_rb_eStandardError)
# define rb_eval_string_protect dll_rb_eval_string_protect
-# ifdef RUBY21_OR_LATER
+# if RUBY_VERSION >= 21
# define rb_funcallv dll_rb_funcallv
# else
# define rb_funcall2 dll_rb_funcall2
@@ -274,7 +259,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define rb_intern dll_rb_intern
# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER <= 18
+# if RUBY_VERSION <= 18
# define rb_fix2int dll_rb_fix2int
# define rb_num2int dll_rb_num2int
# endif
@@ -285,10 +270,10 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define rb_lastline_set dll_rb_lastline_set
# define rb_protect dll_rb_protect
# define rb_load dll_rb_load
-# ifndef RUBY19_OR_LATER
+# if RUBY_VERSION <= 18
# define rb_num2long dll_rb_num2long
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER <= 19
+# if RUBY_VERSION <= 19
# define rb_num2ulong dll_rb_num2ulong
# endif
# define rb_obj_alloc dll_rb_obj_alloc
@@ -309,7 +294,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# else
# define rb_str_new2 dll_rb_str_new2
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
# define rb_string_value dll_rb_string_value
# define rb_string_value_ptr dll_rb_string_value_ptr
# define rb_float_new dll_rb_float_new
@@ -320,7 +305,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# endif
# define rb_ary_new4 dll_rb_ary_new4
# define rb_ary_push dll_rb_ary_push
-# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
+# if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
# ifdef __ia64
# define rb_ia64_bsp dll_rb_ia64_bsp
# undef ruby_init_stack
@@ -332,7 +317,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# else
# define rb_str2cstr dll_rb_str2cstr
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
# define rb_errinfo dll_rb_errinfo
# else
# define ruby_errinfo (*dll_ruby_errinfo)
@@ -340,17 +325,17 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define ruby_init dll_ruby_init
# define ruby_init_loadpath dll_ruby_init_loadpath
# ifdef MSWIN
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
# define ruby_sysinit dll_ruby_sysinit
# else
# define NtInitialize dll_NtInitialize
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
# define rb_w32_snprintf dll_rb_w32_snprintf
# endif
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
# define ruby_script dll_ruby_script
# define rb_enc_find_index dll_rb_enc_find_index
# define rb_enc_find dll_rb_enc_find
@@ -370,7 +355,7 @@ VALUE *dll_rb_cFixnum;
# if defined(USE_RUBY_INTEGER)
VALUE *dll_rb_cInteger;
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20
+# if RUBY_VERSION >= 20
VALUE *dll_rb_cFloat;
# endif
VALUE *dll_rb_cNilClass;
@@ -385,7 +370,7 @@ static void *(*dll_rb_check_typeddata) (VALUE,const rb_data_type_t *);
# endif
static VALUE (*dll_rb_class_path) (VALUE);
# ifdef USE_TYPEDDATA
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23
+# if RUBY_VERSION >= 23
static VALUE (*dll_rb_data_typed_object_wrap) (VALUE, void*, const rb_data_type_t *);
# else
static VALUE (*dll_rb_data_typed_object_alloc) (VALUE, void*, const rb_data_type_t *);
@@ -408,7 +393,7 @@ static VALUE *dll_rb_eIndexError;
static VALUE *dll_rb_eRuntimeError;
static VALUE *dll_rb_eStandardError;
static VALUE (*dll_rb_eval_string_protect) (const char*, int*);
-# ifdef RUBY21_OR_LATER
+# if RUBY_VERSION >= 21
static VALUE (*dll_rb_funcallv) (VALUE, ID, int, const VALUE*);
# else
static VALUE (*dll_rb_funcall2) (VALUE, ID, int, const VALUE*);
@@ -436,7 +421,7 @@ static VALUE (*dll_rb_obj_alloc) (VALUE);
static VALUE (*dll_rb_obj_as_string) (VALUE);
static VALUE (*dll_rb_obj_id) (VALUE);
static void (*dll_rb_raise) (VALUE, const char*, ...);
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
static VALUE (*dll_rb_string_value) (volatile VALUE*);
# else
static char *(*dll_rb_str2cstr) (VALUE,int*);
@@ -450,7 +435,7 @@ static VALUE (*dll_rb_str_new_cstr) (const char*);
# else
static VALUE (*dll_rb_str_new2) (const char*);
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
static VALUE (*dll_rb_errinfo) (void);
# else
static VALUE *dll_ruby_errinfo;
@@ -458,25 +443,25 @@ static VALUE *dll_ruby_errinfo;
static void (*dll_ruby_init) (void);
static void (*dll_ruby_init_loadpath) (void);
# ifdef MSWIN
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
static void (*dll_ruby_sysinit) (int*, char***);
# else
static void (*dll_NtInitialize) (int*, char***);
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
# endif
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
static VALUE (*dll_rb_float_new) (double);
static VALUE (*dll_rb_ary_new) (void);
static VALUE (*dll_rb_ary_new4) (long n, const VALUE *elts);
static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
-# if DYNAMIC_RUBY_VER >= 26
+# if RUBY_VERSION >= 26
static void (*dll_rb_ary_detransient) (VALUE);
# endif
-# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
+# if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
# ifdef __ia64
static void * (*dll_rb_ia64_bsp) (void);
static void (*dll_ruby_init_stack)(VALUE*, void*);
@@ -485,11 +470,11 @@ static void (*dll_ruby_init_stack)(VALUE*);
# endif
# endif
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
static VALUE (*dll_rb_int2big)(SIGNED_VALUE);
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
static void (*dll_ruby_script) (const char*);
static int (*dll_rb_enc_find_index) (const char*);
static rb_encoding* (*dll_rb_enc_find) (const char*);
@@ -500,15 +485,15 @@ static void* (*ruby_options)(int, char**);
# endif
# if defined(USE_RGENGC) && USE_RGENGC
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
+# if RUBY_VERSION == 21
static void (*dll_rb_gc_writebarrier_unprotect_promoted)(VALUE);
# else
static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj);
# endif
# endif
-# if defined(RUBY19_OR_LATER) && !defined(PROTO)
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
+# if (RUBY_VERSION >= 19) && !defined(PROTO)
+# if RUBY_VERSION >= 22
long
rb_num2long_stub(VALUE x)
# else
@@ -518,7 +503,7 @@ rb_num2long_stub(VALUE x)
{
return dll_rb_num2long(x);
}
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26
+# if RUBY_VERSION >= 26
VALUE
rb_int2big_stub(intptr_t x)
# else
@@ -528,8 +513,7 @@ rb_int2big_stub(SIGNED_VALUE x)
{
return dll_rb_int2big(x);
}
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 \
- && VIM_SIZEOF_INT < VIM_SIZEOF_LONG
+# if (RUBY_VERSION >= 19) && (VIM_SIZEOF_INT < VIM_SIZEOF_LONG)
long
rb_fix2int_stub(VALUE x)
{
@@ -541,13 +525,13 @@ rb_num2int_stub(VALUE x)
return dll_rb_num2int(x);
}
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20
+# if RUBY_VERSION >= 20
VALUE
rb_float_new_in_heap(double d)
{
return dll_rb_float_new(d);
}
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
+# if RUBY_VERSION >= 22
unsigned long
rb_num2ulong(VALUE x)
# else
@@ -562,7 +546,7 @@ rb_num2ulong(VALUE x)
// Do not generate a prototype here, VALUE isn't always defined.
# if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO)
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
+# if RUBY_VERSION == 21
void
rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj)
{
@@ -577,7 +561,7 @@ rb_gc_writebarrier_unprotect_stub(VALUE obj)
# endif
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26
+# if RUBY_VERSION >= 26
void
rb_ary_detransient_stub(VALUE x)
{
@@ -603,7 +587,7 @@ static struct
# else
{"rb_cFixnum", (RUBY_PROC*)&dll_rb_cFixnum},
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20
+# if RUBY_VERSION >= 20
{"rb_cFloat", (RUBY_PROC*)&dll_rb_cFloat},
# endif
{"rb_cNilClass", (RUBY_PROC*)&dll_rb_cNilClass},
@@ -618,7 +602,7 @@ static struct
# endif
{"rb_class_path", (RUBY_PROC*)&dll_rb_class_path},
# ifdef USE_TYPEDDATA
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23
+# if RUBY_VERSION >= 23
{"rb_data_typed_object_wrap", (RUBY_PROC*)&dll_rb_data_typed_object_wrap},
# else
{"rb_data_typed_object_alloc", (RUBY_PROC*)&dll_rb_data_typed_object_alloc},
@@ -641,7 +625,7 @@ static struct
{"rb_eRuntimeError", (RUBY_PROC*)&dll_rb_eRuntimeError},
{"rb_eStandardError", (RUBY_PROC*)&dll_rb_eStandardError},
{"rb_eval_string_protect", (RUBY_PROC*)&dll_rb_eval_string_protect},
-# ifdef RUBY21_OR_LATER
+# if RUBY_VERSION >= 21
{"rb_funcallv", (RUBY_PROC*)&dll_rb_funcallv},
# else
{"rb_funcall2", (RUBY_PROC*)&dll_rb_funcall2},
@@ -669,7 +653,7 @@ static struct
{"rb_obj_as_string", (RUBY_PROC*)&dll_rb_obj_as_string},
{"rb_obj_id", (RUBY_PROC*)&dll_rb_obj_id},
{"rb_raise", (RUBY_PROC*)&dll_rb_raise},
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
{"rb_string_value", (RUBY_PROC*)&dll_rb_string_value},
# else
{"rb_str2cstr", (RUBY_PROC*)&dll_rb_str2cstr},
@@ -682,7 +666,7 @@ static struct
# else
{"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
{"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo},
# else
{"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo},
@@ -690,18 +674,18 @@ static struct
{"ruby_init", (RUBY_PROC*)&dll_ruby_init},
{"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
# ifdef MSWIN
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
{"ruby_sysinit", (RUBY_PROC*)&dll_ruby_sysinit},
# else
{"NtInitialize", (RUBY_PROC*)&dll_NtInitialize},
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
{"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
# endif
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
{"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
-# if DYNAMIC_RUBY_VER <= 19
+# if RUBY_VERSION <= 19
{"rb_float_new", (RUBY_PROC*)&dll_rb_float_new},
# else
{"rb_float_new_in_heap", (RUBY_PROC*)&dll_rb_float_new},
@@ -713,11 +697,11 @@ static struct
{"rb_ary_new4", (RUBY_PROC*)&dll_rb_ary_new4},
# endif
{"rb_ary_push", (RUBY_PROC*)&dll_rb_ary_push},
-# if DYNAMIC_RUBY_VER >= 26
+# if RUBY_VERSION >= 26
{"rb_ary_detransient", (RUBY_PROC*)&dll_rb_ary_detransient},
# endif
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
{"rb_int2big", (RUBY_PROC*)&dll_rb_int2big},
{"ruby_script", (RUBY_PROC*)&dll_ruby_script},
{"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
@@ -727,14 +711,14 @@ static struct
{"rb_require", (RUBY_PROC*)&dll_rb_require},
{"ruby_options", (RUBY_PROC*)&dll_ruby_options},
# endif
-# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
+# if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
# ifdef __ia64
{"rb_ia64_bsp", (RUBY_PROC*)&dll_rb_ia64_bsp},
# endif
{"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
# endif
# if defined(USE_RGENGC) && USE_RGENGC
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
+# if RUBY_VERSION == 21
{"rb_gc_writebarrier_unprotect_promoted", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect_promoted},
# else
{"rb_gc_writebarrier_unprotect", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect},
@@ -837,7 +821,7 @@ ex_ruby(exarg_T *eap)
static VALUE
vim_str2rb_enc_str(const char *s)
{
-#ifdef RUBY19_OR_LATER
+#if RUBY_VERSION >= 19
int isnum;
long lval;
char_u *sval;
@@ -858,7 +842,7 @@ vim_str2rb_enc_str(const char *s)
static VALUE
eval_enc_string_protect(const char *str, int *state)
{
-#ifdef RUBY19_OR_LATER
+#if RUBY_VERSION >= 19
int isnum;
long lval;
char_u *sval;
@@ -982,19 +966,19 @@ ensure_ruby_initialized(void)
int argc = 1;
char *argv[] = {"gvim.exe"};
char **argvp = argv;
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
ruby_sysinit(&argc, &argvp);
# else
NtInitialize(&argc, &argvp);
# endif
#endif
{
-#if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
+#if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
ruby_init_stack(ruby_stack_start);
#endif
ruby_init();
}
-#ifdef RUBY19_OR_LATER
+#if RUBY_VERSION >= 19
{
int dummy_argc = 2;
char *dummy_argv[] = {"vim-ruby", "-e_=0"};
@@ -1022,7 +1006,7 @@ ensure_ruby_initialized(void)
static void
error_print(int state)
{
-#if !defined(DYNAMIC_RUBY) && !defined(RUBY19_OR_LATER)
+#if !defined(DYNAMIC_RUBY) && (RUBY_VERSION <= 18)
RUBYEXTERN VALUE ruby_errinfo;
#endif
VALUE error;
@@ -1062,7 +1046,7 @@ error_print(int state)
break;
case TAG_RAISE:
case TAG_FATAL:
-#ifdef RUBY19_OR_LATER
+#if RUBY_VERSION >= 19
error = rb_errinfo();
#else
error = ruby_errinfo;
@@ -1087,7 +1071,7 @@ error_print(int state)
}
attr = syn_name2attr((char_u *)"Error");
-# ifdef RUBY21_OR_LATER
+# if RUBY_VERSION >= 21
bt = rb_funcallv(error, rb_intern("backtrace"), 0, 0);
for (i = 0; i < RARRAY_LEN(bt); i++)
msg_attr(RSTRING_PTR(RARRAY_AREF(bt, i)), attr);
@@ -1242,7 +1226,13 @@ static size_t buffer_dsize(const void *buf);
static const rb_data_type_t buffer_type = {
"vim_buffer",
- {0, 0, buffer_dsize, {0, 0}},
+ {0, 0, buffer_dsize,
+# if RUBY_VERSION >= 27
+ 0, 0
+# else
+ {0, 0}
+# endif
+ },
0, 0,
# ifdef RUBY_TYPED_FREE_IMMEDIATELY
0,
@@ -1516,7 +1506,13 @@ static size_t window_dsize(const void *buf);
static const rb_data_type_t window_type = {
"vim_window",
- {0, 0, window_dsize, {0, 0}},
+ {0, 0, window_dsize,
+# if RUBY_VERSION >= 27
+ 0, 0
+# else
+ {0, 0}
+# endif
+ },
0, 0,
# ifdef RUBY_TYPED_FREE_IMMEDIATELY
0,

View File

@ -1,66 +0,0 @@
From 2ddb89f8a94425cda1e5491efc80c1ccccb6e08e Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sat, 4 Sep 2021 21:20:41 +0200
Subject: [PATCH] patch 8.2.3403: memory leak for :retab with invalid argument
Problem: Memory leak for :retab with invalid argument.
Solution: Free the memory. Make error messages consistent.
---
src/indent.c | 13 +++++++++++--
src/version.c | 2 ++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/indent.c b/src/indent.c
index 7e196c2..7d04373 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -70,9 +70,12 @@ tabstop_set(char_u *var, int **array)
{
int n = atoi((char *)cp);
+ // Catch negative values, overflow and ridiculous big values.
if (n < 0 || n > 9999)
{
semsg(_(e_invarg2), cp);
+ vim_free(*array);
+ *array = NULL;
return FAIL;
}
(*array)[t++] = n;
@@ -1580,12 +1583,18 @@ ex_retab(exarg_T *eap)
else
new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str);
#else
- new_ts = getdigits(&(eap->arg));
- if (new_ts < 0)
+ ptr = eap->arg;
+ new_ts = getdigits(&ptr);
+ if (new_ts < 0 && *eap->arg == '-')
{
emsg(_(e_positive));
return;
}
+ if (new_ts < 0 || new_ts > 9999)
+ {
+ semsg(_(e_invarg2), eap->arg);
+ return;
+ }
if (new_ts == 0)
new_ts = curbuf->b_p_ts;
#endif
diff --git a/src/version.c b/src/version.c
index 8912f62..f8e4561 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3403,
+/**/
3402,
/**/
0
--
1.8.3.1

View File

@ -1,29 +0,0 @@
From 61015162ba834541c42da5db6f3fa0ebe1d40e87 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 28 Jan 2021 17:56:09 +0100
Subject: [PATCH] patch 8.2.2423: missing error message
Conflict:add missing error message
Reference:https://github.com/vim/vim/commit/61015162ba834541c42da5db6f3fa0ebe1d40e87
Problem: Missing error message.
Solution: Add the error message.
---
src/globals.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/globals.h b/src/globals.h
index 009834c..872e895 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1451,6 +1451,7 @@ EXTERN int netbeansSuppressNoLines INIT(= 0); // skip "No lines in buffer"
*/
EXTERN char e_abort[] INIT(= N_("E470: Command aborted"));
EXTERN char e_argreq[] INIT(= N_("E471: Argument required"));
+EXTERN char e_cannot_change_arglist_recursively[] INIT(= N_("E1156: Cannot change the argument list recursively"));
EXTERN char e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &"));
#ifdef FEAT_CMDWIN
EXTERN char e_cmdwin[] INIT(= N_("E11: Invalid in command-line window; <CR> executes, CTRL-C quits"));
--
2.27.0

View File

@ -1,70 +0,0 @@
From 2d10cd478047df8ba144d4b0fcc46480993af57f Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 19 Mar 2020 14:37:30 +0100
Subject: [PATCH] patch 8.2.0407: no early check if :find and :sfind have an
argument
Problem: No early check if :find and :sfind have an argument.
Solution: Add EX_NEEDARG.
Reference:https://github.com/vim/vim/commit/2d10cd478047df8ba144d4b0fcc46480993af57f
---
src/ex_cmds.h | 4 ++--
src/testdir/test_find_complete.vim | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index 983378c..28ea6ee 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -572,7 +572,7 @@ EXCMD(CMD_filter, "filter", ex_wrongmodifier,
EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM,
ADDR_NONE),
EXCMD(CMD_find, "find", ex_find,
- EX_RANGE|EX_BANG|EX_FILE1|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
+ EX_RANGE|EX_BANG|EX_FILE1|EX_CMDARG|EX_ARGOPT|EX_TRLBAR|EX_NEEDARG,
ADDR_OTHER),
EXCMD(CMD_finally, "finally", ex_finally,
EX_TRLBAR|EX_SBOXOK|EX_CMDWIN,
@@ -1319,7 +1319,7 @@ EXCMD(CMD_setlocal, "setlocal", ex_set,
EX_TRLBAR|EX_EXTRA|EX_CMDWIN|EX_SBOXOK,
ADDR_NONE),
EXCMD(CMD_sfind, "sfind", ex_splitview,
- EX_BANG|EX_FILE1|EX_RANGE|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
+ EX_BANG|EX_FILE1|EX_RANGE|EX_CMDARG|EX_ARGOPT|EX_TRLBAR|EX_NEEDARG,
ADDR_OTHER),
EXCMD(CMD_sfirst, "sfirst", ex_rewind,
EX_EXTRA|EX_BANG|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
diff --git a/src/testdir/test_find_complete.vim b/src/testdir/test_find_complete.vim
index 679bf3c..32ca967 100644
--- a/src/testdir/test_find_complete.vim
+++ b/src/testdir/test_find_complete.vim
@@ -15,22 +15,22 @@ func Test_find_complete()
new
set path=
- call assert_fails('call feedkeys(":find\t\n", "xt")', 'E345:')
+ call assert_fails('call feedkeys(":find \t\n", "xt")', 'E471:')
close
new
set path=.
- call assert_fails('call feedkeys(":find\t\n", "xt")', 'E32:')
+ call assert_fails('call feedkeys(":find \t\n", "xt")', 'E471:')
close
new
set path=.,,
- call assert_fails('call feedkeys(":find\t\n", "xt")', 'E32:')
+ call assert_fails('call feedkeys(":find \t\n", "xt")', 'E471:')
close
new
set path=./**
- call assert_fails('call feedkeys(":find\t\n", "xt")', 'E32:')
+ call assert_fails('call feedkeys(":find \t\n", "xt")', 'E471:')
close
" We shouldn't find any file till this point
--
2.23.0

View File

@ -1,34 +0,0 @@
From fe978c2b6bb9d897d962595a4a51dd7a71dc8e89 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 8 May 2022 22:43:51 +0100
Subject: [PATCH] patch 8.2.4921: spell test fails because of new illegal byte
check
Problem: Spell test fails because of new illegal byte check.
Solution: Remove the test.
---
src/testdir/test_spell.vim | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim
index 49118a9..437ad5c 100644
--- a/src/testdir/test_spell.vim
+++ b/src/testdir/test_spell.vim
@@ -552,14 +552,6 @@ func Test_spell_screendump()
call delete('XtestSpell')
endfunc
-func Test_spell_single_word()
- new
- silent! norm 0R00
- spell! ßÂ
- silent 0norm 0r$ Dvz=
- bwipe!
-endfunc
-
let g:test_data_aff1 = [
\"SET ISO8859-1",
\"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
--
1.8.3.1

View File

@ -1,37 +0,0 @@
From 150fab01a9e9eb61061bf145998b608c5c9c470e Mon Sep 17 00:00:00 2001
From: lvying6 <lvying6@huawei.com>
Date: Tue, 14 Jul 2020 16:43:33 +0800
Subject: [PATCH] vim: fix garbled characters display when file name matches
warning or error in tar file
Reference: https://github.com/vim/vim/issues/6425
The problem is, the tar.vim plugin checks if the last line matches
warning or error or a few other keywords and if it does, it aborts.
Signed-off-by: lvying6 <lvying6@huawei.com>
---
runtime/autoload/tar.vim | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index dc670db..168a2f1 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -184,7 +184,12 @@ fun! tar#Browse(tarfile)
" call Dret("tar#Browse : a:tarfile<".a:tarfile.">")
return
endif
- if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~ '\c\%(warning\|error\|inappropriate\|unrecognized\)')
+ " If there was an error message, the last line probably matches some keywords but
+ " should also contain whitespace for readability. Make sure not to match a
+ " filename that contains the keyword (error/warning/unrecognized/inappropriate, etc)
+ if line("$") == curlast || ( line("$") == (curlast + 1) &&
+ \ getline("$") =~# '\c\<\%(warning\|error\|inappropriate\|unrecognized\)\>' &&
+ \ getline("$") =~ '\s' )
redraw!
echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None
keepj sil! %d
--
1.8.3.1

View File

@ -1,26 +1,26 @@
diff -up vim81/src/term.c.fixkeys vim81/src/term.c
--- vim81/src/term.c.fixkeys 2019-12-12 09:00:20.685567074 +0100
+++ vim81/src/term.c 2019-12-12 09:21:36.708769626 +0100
@@ -957,14 +957,14 @@ static struct builtin_term builtin_termc
{K_XRIGHT, IF_EB("\033[1;*C", ESC_STR "[1;*C")},
{K_XLEFT, IF_EB("\033[1;*D", ESC_STR "[1;*D")},
diff -up vim82/src/term.c.fixkeys vim82/src/term.c
--- vim82/src/term.c.fixkeys 2022-02-07 09:23:09.195365881 +0100
+++ vim82/src/term.c 2022-02-07 09:31:31.279695977 +0100
@@ -921,14 +921,14 @@ static struct builtin_term builtin_termc
{K_XRIGHT, "\033[@;*C"},
{K_XLEFT, "\033[@;*D"},
// An extra set of function keys for vt100 mode
- {K_XF1, IF_EB("\033O*P", ESC_STR "O*P")},
- {K_XF2, IF_EB("\033O*Q", ESC_STR "O*Q")},
- {K_XF3, IF_EB("\033O*R", ESC_STR "O*R")},
- {K_XF4, IF_EB("\033O*S", ESC_STR "O*S")},
- {K_F1, IF_EB("\033[11;*~", ESC_STR "[11;*~")},
- {K_F2, IF_EB("\033[12;*~", ESC_STR "[12;*~")},
- {K_F3, IF_EB("\033[13;*~", ESC_STR "[13;*~")},
- {K_F4, IF_EB("\033[14;*~", ESC_STR "[14;*~")},
+ {K_XF1, IF_EB("\033[11~", ESC_STR "[11~")},
+ {K_XF2, IF_EB("\033[12~", ESC_STR "[12~")},
+ {K_XF3, IF_EB("\033[13~", ESC_STR "[13~")},
+ {K_XF4, IF_EB("\033[14~", ESC_STR "[14~")},
+ {K_F1, IF_EB("\033OP", ESC_STR "OP")},
+ {K_F2, IF_EB("\033OQ", ESC_STR "OQ")},
+ {K_F3, IF_EB("\033OR", ESC_STR "OR")},
+ {K_F4, IF_EB("\033OS", ESC_STR "OS")},
{K_F5, IF_EB("\033[15;*~", ESC_STR "[15;*~")},
{K_F6, IF_EB("\033[17;*~", ESC_STR "[17;*~")},
{K_F7, IF_EB("\033[18;*~", ESC_STR "[18;*~")},
- {K_XF1, "\033O*P"},
- {K_XF2, "\033O*Q"},
- {K_XF3, "\033O*R"},
- {K_XF4, "\033O*S"},
- {K_F1, "\033[11;*~"},
- {K_F2, "\033[12;*~"},
- {K_F3, "\033[13;*~"},
- {K_F4, "\033[14;*~"},
+ {K_XF1, "\033[11~"},
+ {K_XF2, "\033[12~"},
+ {K_XF3, "\033[13~"},
+ {K_XF4, "\033[14~"},
+ {K_F1, "\033OP"},
+ {K_F2, "\033OQ"},
+ {K_F3, "\033OR"},
+ {K_F4, "\033OS"},
{K_F5, "\033[15;*~"},
{K_F6, "\033[17;*~"},
{K_F7, "\033[18;*~"},

View File

@ -1,15 +0,0 @@
--- vim62/src/os_unix.h.rcloc 2003-08-04 15:38:05.000000000 +0200
+++ vim62/src/os_unix.h 2003-08-04 15:39:25.000000000 +0200
@@ -230,10 +230,10 @@
* Unix system-dependent file names
*/
#ifndef SYS_VIMRC_FILE
-# define SYS_VIMRC_FILE "$VIM/vimrc"
+# define SYS_VIMRC_FILE "/etc/vimrc"
#endif
#ifndef SYS_GVIMRC_FILE
-# define SYS_GVIMRC_FILE "$VIM/gvimrc"
+# define SYS_GVIMRC_FILE "/etc/gvimrc"
#endif
#ifndef DFLT_HELPFILE
# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt"

View File

@ -1,12 +0,0 @@
diff -up vim74/runtime/syntax/spec.vim.kh1 vim74/runtime/syntax/spec.vim
--- vim74/runtime/syntax/spec.vim.kh1 2016-08-04 15:23:25.275955301 +0200
+++ vim74/runtime/syntax/spec.vim 2016-08-04 15:24:56.699417602 +0200
@@ -114,7 +114,7 @@ syn region specDescriptionArea matchgrou
syn region specPackageArea matchgroup=specSection start='^%package' end='^%'me=e-1 contains=specPackageOpts,specPreAmble,specComment
"%% Scripts Section %%
-syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
+syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|check\|clean\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|find_lang\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
"%% Changelog Section %%
syn region specChangelogArea matchgroup=specSection start='^%changelog' end='^%'me=e-1 contains=specEmail,specURL,specWeekday,specMonth,specNumber,specComment,specLicense

View File

@ -1,6 +1,6 @@
diff -up vim81/runtime/syntax/fstab.vim.fstabsyntax vim81/runtime/syntax/fstab.vim
--- vim81/runtime/syntax/fstab.vim.fstabsyntax 2019-06-11 09:55:23.000000000 +0200
+++ vim81/runtime/syntax/fstab.vim 2019-06-11 10:14:22.223616868 +0200
diff -up vim82/runtime/syntax/fstab.vim.fstabsyntax vim82/runtime/syntax/fstab.vim
--- vim82/runtime/syntax/fstab.vim.fstabsyntax 2020-08-10 12:08:01.000000000 +0200
+++ vim82/runtime/syntax/fstab.vim 2020-08-10 12:17:22.540855735 +0200
@@ -56,7 +56,7 @@ syn keyword fsMountPointKeyword containe
" Type
syn cluster fsTypeCluster contains=fsTypeKeyword,fsTypeUnknown
@ -14,7 +14,7 @@ diff -up vim81/runtime/syntax/fstab.vim.fstabsyntax vim81/runtime/syntax/fstab.v
syn keyword fsOptionsYesNo yes no
syn cluster fsOptionsCheckCluster contains=fsOptionsExt2Check,fsOptionsFatCheck
syn keyword fsOptionsSize 512 1024 2048
-syn keyword fsOptionsGeneral async atime auto bind current defaults dev devgid devmode devmtime devuid dirsync exec force fstab kudzu loop mand move noatime noauto noclusterr noclusterw nodev nodevmtime nodiratime noexec nomand norelatime nosuid nosymfollow nouser owner rbind rdonly relatime remount ro rq rw suid suiddir supermount sw sync union update user users wxallowed xx nofail
-syn keyword fsOptionsGeneral async atime auto bind current defaults dev devgid devmode devmtime devuid dirsync exec force fstab kudzu loop mand move noatime noauto noclusterr noclusterw nodev nodevmtime nodiratime noexec nomand norelatime nosuid nosymfollow nouser owner rbind rdonly relatime remount ro rq rw suid suiddir supermount sw sync union update user users wxallowed xx nofail failok
+syn keyword fsOptionsGeneral async atime auto bind current defaults dev devgid devmode devmtime devuid dirsync exec force fstab kudzu loop managed mand move noatime noauto noclusterr noclusterw nodev nodevmtime nodiratime noexec nomand norelatime nosuid nosymfollow nouser owner pamconsole rbind rdonly relatime remount ro rq rw suid suiddir supermount sw sync union update user users wxallowed xx nofail
syn match fsOptionsGeneral /_netdev/

View File

@ -1,12 +1,13 @@
diff -up vim74/runtime/syntax/spec.vim.orig vim74/runtime/syntax/spec.vim
--- vim74/runtime/syntax/spec.vim.orig 2016-01-12 13:51:55.727569873 +0100
+++ vim74/runtime/syntax/spec.vim 2016-01-12 13:53:08.124991178 +0100
@@ -114,7 +114,7 @@ syn region specDescriptionArea matchgrou
diff --git a/runtime/syntax/spec.vim b/runtime/syntax/spec.vim
index 1a5a108..b709d20 100644
--- a/runtime/syntax/spec.vim
+++ b/runtime/syntax/spec.vim
@@ -111,7 +111,7 @@ syn region specDescriptionArea matchgroup=specSection start='^%description' end=
syn region specPackageArea matchgroup=specSection start='^%package' end='^%'me=e-1 contains=specPackageOpts,specPreAmble,specComment
"%% Scripts Section %%
-syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|check\|clean\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|find_lang\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
+syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|check\|clean\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|global\|patch\d*\|configure\|GNUconfigure\|setup\|find_lang\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
-syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
+syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|global\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
"%% Changelog Section %%
syn region specChangelogArea matchgroup=specSection start='^%changelog' end='^%'me=e-1 contains=specEmail,specURL,specWeekday,specMonth,specNumber,specComment,specLicense

View File

@ -1,11 +0,0 @@
diff -up vim81/src/ex_docmd.c.backup vim81/src/ex_docmd.c
--- vim81/src/ex_docmd.c.backup 2019-01-22 17:35:28.701320672 +0100
+++ vim81/src/ex_docmd.c 2019-01-22 17:36:56.644540351 +0100
@@ -4793,6 +4793,7 @@ get_flags(exarg_T *eap)
void
ex_ni(exarg_T *eap)
{
+ return;
if (!eap->skip)
eap->errmsg = N_("E319: Sorry, the command is not available in this version");
}

View File

@ -1,14 +0,0 @@
diff -up vim74/runtime/ftplugin/spec.vim.1318991 vim74/runtime/ftplugin/spec.vim
--- vim74/runtime/ftplugin/spec.vim.1318991 2016-08-04 15:29:42.423862424 +0200
+++ vim74/runtime/ftplugin/spec.vim 2016-08-04 15:31:08.797299188 +0200
@@ -41,8 +41,8 @@ else:
headers = spec.sourceHeader
version = headers["Version"]
release = headers["Release"]
- vim.command("let ver = " + version)
- vim.command("let rel = " + release)
+ vim.command("let ver = '" + version + "'")
+ vim.command("let rel = '" + release + "'")
PYEND
endif
endfunction

View File

@ -1,26 +0,0 @@
diff --git a/src/highlight.c b/src/highlight.c
index 9322f96..f7147a0 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -211,8 +211,8 @@ static char *(highlight_init_light[]) = {
CENT("Visual term=reverse",
"Visual term=reverse guibg=LightGrey"),
#ifdef FEAT_DIFF
- CENT("DiffAdd term=bold ctermbg=LightBlue",
- "DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue"),
+ CENT("DiffAdd term=bold ctermbg=LightRed",
+ "DiffAdd term=bold ctermbg=LightRed guibg=LightBlue"),
CENT("DiffChange term=bold ctermbg=LightMagenta",
"DiffChange term=bold ctermbg=LightMagenta guibg=LightMagenta"),
CENT("DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan",
@@ -304,8 +304,8 @@ static char *(highlight_init_dark[]) = {
CENT("Visual term=reverse",
"Visual term=reverse guibg=DarkGrey"),
#ifdef FEAT_DIFF
- CENT("DiffAdd term=bold ctermbg=DarkBlue",
- "DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue"),
+ CENT("DiffAdd term=bold ctermbg=DarkRed",
+ "DiffAdd term=bold ctermbg=DarkRed guibg=DarkBlue"),
CENT("DiffChange term=bold ctermbg=DarkMagenta",
"DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta"),
CENT("DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan",

View File

@ -1,11 +0,0 @@
--- vim74/runtime/filetype.vim.orig 2013-08-12 14:51:58.669350813 +0200
+++ vim74/runtime/filetype.vim 2013-08-12 14:56:12.432540523 +0200
@@ -2475,7 +2475,7 @@
" More Apache config files
au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache')
-au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/apache2/conf.*/*,*/etc/apache2/mods-*/*,*/etc/apache2/sites-*/*,*/etc/httpd/conf.d/*.conf* call s:StarSetf('apache')
+au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/httpd/conf.*/*,*/etc/httpd/mods-*/*,*/etc/httpd/sites-*/*,*/etc/httpd/conf.d/*.conf*,auth_mysql.conf*,auth_pgsql.conf*,ssl.conf*,perl.conf*,php.conf*,python.conf*,squirrelmail.conf* call s:StarSetf('apache')
" Asterisk config file
au BufNewFile,BufRead *asterisk/*.conf* call s:StarSetf('asterisk')

View File

@ -1,7 +1,8 @@
diff -up vim81/runtime/defaults.vim.copypaste vim81/runtime/defaults.vim
--- vim81/runtime/defaults.vim.copypaste 2019-10-30 10:30:23.108710252 +0100
+++ vim81/runtime/defaults.vim 2019-10-30 10:36:19.127508406 +0100
@@ -73,18 +73,6 @@ map Q gq
diff --git a/runtime/defaults.vim b/runtime/defaults.vim
index f1d5cd1..b08de8e 100644
--- a/runtime/defaults.vim
+++ b/runtime/defaults.vim
@@ -74,18 +74,6 @@ sunmap Q
" Revert with ":iunmap <C-U>".
inoremap <C-U> <C-G>u<C-U>
@ -17,6 +18,70 @@ diff -up vim81/runtime/defaults.vim.copypaste vim81/runtime/defaults.vim
- endif
-endif
-
" Switch syntax highlighting on when the terminal has colors or when using the
" GUI (which always has colors).
if &t_Co > 2 || has("gui_running")
" Only do this part when Vim was compiled with the +eval feature.
if 1
diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim
index ed0c6c1..90c8c40 100644
--- a/src/testdir/test_balloon.vim
+++ b/src/testdir/test_balloon.vim
@@ -9,6 +9,7 @@ source screendump.vim
CheckScreendump
let s:common_script =<< trim [CODE]
+ set mouse=a
call setline(1, ["one one one", "two tXo two", "three three three"])
set balloonevalterm balloonexpr=MyBalloonExpr()..s:trailing balloondelay=100
let s:trailing = '<' " check that script context is set
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index b91689e..c6b70d1 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -553,6 +553,7 @@ func Test_popup_drag()
" create a popup that covers the command line
let lines =<< trim END
call setline(1, range(1, 20))
+ set mouse=a
split
vsplit
$wincmd w
@@ -621,6 +622,7 @@ func Test_popup_drag_minwidth()
" create a popup that does not fit
let lines =<< trim END
+ set mouse=a
call range(40)
\ ->map({_,i -> string(i)})
\ ->popup_create({
@@ -669,6 +671,7 @@ func Test_popup_drag_termwin()
let lines =<< trim END
set foldmethod=marker
call setline(1, range(100))
+ set mouse=a
for nr in range(7)
call setline(nr * 12 + 1, "fold {{{")
call setline(nr * 12 + 11, "end }}}")
@@ -722,6 +725,7 @@ func Test_popup_close_with_mouse()
let lines =<< trim END
call setline(1, range(1, 20))
+ set mouse=a
" With border, can click on X
let winid = popup_create('foobar', #{
\ close: 'button',
@@ -1557,6 +1561,7 @@ func Test_popup_beval()
let lines =<< trim END
call setline(1, range(1, 20))
call setline(5, 'here is some text to hover over')
+ set mouse=a
set balloonevalterm
set balloonexpr=BalloonExpr()
set balloondelay=100
@@ -2262,6 +2267,7 @@ func Test_popup_scrollbar()
let lines =<< trim END
call setline(1, range(1, 20))
+ set mouse=a
hi ScrollThumb ctermbg=blue
hi ScrollBar ctermbg=red
let winid = popup_create(['one', 'two', 'three', 'four', 'five',

Binary file not shown.

View File

@ -1,16 +1,16 @@
diff -up vim80/runtime/tools/demoserver.py.python3-tests vim80/runtime/tools/demoserver.py
--- vim80/runtime/tools/demoserver.py.python3-tests 2018-05-11 08:24:41.774618804 +0200
+++ vim80/runtime/tools/demoserver.py 2018-05-11 09:24:48.363309856 +0200
diff -up vim82/runtime/tools/demoserver.py.python-tests vim82/runtime/tools/demoserver.py
--- vim82/runtime/tools/demoserver.py.python-tests 2019-07-26 07:58:50.000000000 +0200
+++ vim82/runtime/tools/demoserver.py 2020-04-17 06:18:06.748977527 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#
# Server that will accept connections from a Vim channel.
# Run this server and then in Vim you can open the channel:
diff -up vim80/src/auto/configure.python3-tests vim80/src/auto/configure
--- vim80/src/auto/configure.python3-tests 2018-05-11 08:25:03.632420873 +0200
+++ vim80/src/auto/configure 2018-05-11 09:25:26.062000471 +0200
@@ -6396,7 +6396,7 @@ eof
diff -up vim82/src/auto/configure.python-tests vim82/src/auto/configure
--- vim82/src/auto/configure.python-tests 2020-04-17 06:07:48.000000000 +0200
+++ vim82/src/auto/configure 2020-04-17 06:18:06.750977509 +0200
@@ -6418,7 +6418,7 @@ eof
if test "x$MACOS_X" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \
"import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
vi_cv_path_python_plibs="-framework Python"
@ -19,10 +19,10 @@ diff -up vim80/src/auto/configure.python3-tests vim80/src/auto/configure
vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python"
fi
else
diff -up vim80/src/configure.ac.python3-tests vim80/src/configure.ac
--- vim80/src/configure.ac.python3-tests 2018-05-11 08:25:26.070218957 +0200
+++ vim80/src/configure.ac 2018-05-11 09:26:01.603708243 +0200
@@ -1248,7 +1248,7 @@ eof
diff -up vim82/src/configure.ac.python-tests vim82/src/configure.ac
--- vim82/src/configure.ac.python-tests 2020-04-17 06:07:48.000000000 +0200
+++ vim82/src/configure.ac 2020-04-17 06:18:06.750977509 +0200
@@ -1263,7 +1263,7 @@ eof
if test "x$MACOS_X" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \
"import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
vi_cv_path_python_plibs="-framework Python"
@ -31,54 +31,54 @@ diff -up vim80/src/configure.ac.python3-tests vim80/src/configure.ac
vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python"
fi
else
diff -up vim80/src/testdir/test_channel_pipe.py.python3-tests vim80/src/testdir/test_channel_pipe.py
--- vim80/src/testdir/test_channel_pipe.py.python3-tests 2018-05-11 09:23:05.738146018 +0200
+++ vim80/src/testdir/test_channel_pipe.py 2018-05-11 09:26:37.354413350 +0200
diff -up vim82/src/testdir/test_channel_pipe.py.python-tests vim82/src/testdir/test_channel_pipe.py
--- vim82/src/testdir/test_channel_pipe.py.python-tests 2019-07-26 07:58:53.000000000 +0200
+++ vim82/src/testdir/test_channel_pipe.py 2020-04-17 06:18:06.751977500 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#
# Server that will communicate over stdin/stderr
#
diff -up vim80/src/testdir/test_channel.py.python3-tests vim80/src/testdir/test_channel.py
--- vim80/src/testdir/test_channel.py.python3-tests 2018-05-11 09:22:48.522284266 +0200
+++ vim80/src/testdir/test_channel.py 2018-05-11 09:26:17.762574955 +0200
diff -up vim82/src/testdir/test_channel.py.python-tests vim82/src/testdir/test_channel.py
--- vim82/src/testdir/test_channel.py.python-tests 2020-04-17 06:18:06.751977500 +0200
+++ vim82/src/testdir/test_channel.py 2020-04-17 06:18:24.517813082 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
-#!/usr/bin/env python
+#!/usr/bin/python3
#
# Server that will accept connections from a Vim channel.
# Used by test_channel.vim.
diff -up vim80/src/testdir/test_channel_write.py.python3-tests vim80/src/testdir/test_channel_write.py
--- vim80/src/testdir/test_channel_write.py.python3-tests 2018-05-11 09:23:21.254021422 +0200
+++ vim80/src/testdir/test_channel_write.py 2018-05-11 09:26:54.952268193 +0200
diff -up vim82/src/testdir/test_channel_write.py.python-tests vim82/src/testdir/test_channel_write.py
--- vim82/src/testdir/test_channel_write.py.python-tests 2019-07-26 07:58:53.000000000 +0200
+++ vim82/src/testdir/test_channel_write.py 2020-04-17 06:18:06.751977500 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#
# Program that writes a number to stdout repeatedly
#
diff -up vim80/src/testdir/test_makeencoding.py.python3-tests vim80/src/testdir/test_makeencoding.py
--- vim80/src/testdir/test_makeencoding.py.python3-tests 2018-05-11 09:23:38.990878990 +0200
+++ vim80/src/testdir/test_makeencoding.py 2018-05-11 09:27:14.402107759 +0200
diff -up vim82/src/testdir/test_makeencoding.py.python-tests vim82/src/testdir/test_makeencoding.py
--- vim82/src/testdir/test_makeencoding.py.python-tests 2019-07-26 07:58:53.000000000 +0200
+++ vim82/src/testdir/test_makeencoding.py 2020-04-17 06:18:06.751977500 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Test program for :make, :grep and :cgetfile.
diff -up vim80/src/testdir/test_netbeans.py.python3-tests vim80/src/testdir/test_netbeans.py
--- vim80/src/testdir/test_netbeans.py.python3-tests 2018-05-11 09:23:54.398752732 +0200
+++ vim80/src/testdir/test_netbeans.py 2018-05-11 09:27:30.489975057 +0200
diff -up vim82/src/testdir/test_netbeans.py.python-tests vim82/src/testdir/test_netbeans.py
--- vim82/src/testdir/test_netbeans.py.python-tests 2019-07-26 07:58:53.000000000 +0200
+++ vim82/src/testdir/test_netbeans.py 2020-04-17 06:18:06.751977500 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#
# Server that will communicate with Vim through the netbeans interface.
# Used by test_netbeans.vim.
diff -up vim80/src/testdir/test_short_sleep.py.python3-tests vim80/src/testdir/test_short_sleep.py
--- vim80/src/testdir/test_short_sleep.py.python3-tests 2018-05-11 09:24:09.134631798 +0200
+++ vim80/src/testdir/test_short_sleep.py 2018-05-11 09:27:48.432827053 +0200
diff -up vim82/src/testdir/test_short_sleep.py.python-tests vim82/src/testdir/test_short_sleep.py
--- vim82/src/testdir/test_short_sleep.py.python-tests 2019-07-26 07:58:53.000000000 +0200
+++ vim82/src/testdir/test_short_sleep.py 2020-04-17 06:18:06.751977500 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3

102
vim.spec
View File

@ -6,110 +6,26 @@
%{!?_with_lua__:%define _with_lua__ 1}
%{!?_with_netbeans__:%define _with_netbeans__ 1}
%define vimdir vim82
%define vimdir vim90
%define python_ver %{python3_version}
Name: vim
Epoch: 2
Version: 8.2
Release: 39
Version: 9.0
Release: 1
Summary: Vim is a highly configurable text editor for efficiently creating and changing any kind of text.
License: Vim and MIT
URL: http://www.vim.org
Source0: ftp://ftp.vim.org/pub/vim/unix/vim-8.2.tar.bz2
Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{version}.tar.bz2
Source1: virc
Source2: vimrc
Patch0000: vim-7.0-fixkeys.patch
Patch0001: vim-7.4-specsyntax.patch
Patch0002: vim-7.4-syntax.patch
Patch0003: vim-7.4-nowarnings.patch
Patch0004: vim-7.0-rclocation.patch
Patch0005: vim-7.4-checkhl.patch
Patch0006: vim-7.4-fstabsyntax.patch
Patch0007: vim-7.4-syncolor.patch
Patch0009: vim-7.4-globalsyntax.patch
Patch0010: vim-7.4-releasestring-1318991.patch
Patch0011: vim-8.0-copy-paste.patch
Patch0012: vim-python3-tests.patch
Patch0013: Fix-vim-lua5.4.0-defines+luaL_typeerror-twice.patch
Patch6000: backport-Configure-does-not-recognize-gcc-10.0-and-later.patch
Patch6001: backport-8.2.2550-signal-stack-size-is-wrong-with-lates.patch
Patch6002: backport-CVE-2021-3770.patch
Patch6003: backport-memory-leak-for-retab-with-invalid-argument.patch
Patch6004: backport-CVE-2021-3778.patch
Patch6005: backport-CVE-2021-3796.patch
Patch6006: backport-CVE-2021-3872.patch
Patch6007: backport-CVE-2021-3875.patch
Patch6008: backport-CVE-2021-3903.patch
Patch6009: backport-CVE-2021-3927.patch
Patch6010: backport-CVE-2021-3928.patch
Patch6011: backport-Python-3.9-does-not-define-_Py_DEC_REFTOTAL.patch
Patch6012: backport-linker-errors-when-building-with-dynamic-Python-3.9.patch
Patch6013: backport-PyEval_InitThreads-is-deprecated-in-Python-3.9.patch
Patch6014: backport-linker-errors-with-dynamic-Python-3.10.patch
Patch6015: backport-configure-cannot-detect-Python-3.10.patch
Patch6016: backport-CVE-2021-3973.patch
Patch6017: backport-CVE-2021-3974.patch
Patch6018: backport-find-test-fails.patch
Patch6019: backport-no-early-check-if-find-and-sfind-have-an-argument.patch
Patch6020: backport-CVE-2021-3984.patch
Patch6021: backport-CVE-2021-4019.patch
Patch6022: backport-CVE-2021-4069.patch
Patch6023: backport-build-failure-with-Perl5.32.patch
Patch6024: backport-cannot-build-with-Strawberry-Perl-5.32.0.patch
Patch6025: backport-cannot-build-with-Perl-5.34.patch
Patch6026: backport-macros-for-Ruby-are-too-complicated.patch
Patch6027: backport-build-problem-with-Ruby-2.7.patch
Patch6028: backport-Ruby-missing-function-prototype.patch
Patch6029: backport-build-failure-with-some-Ruby-versions.patch
Patch6030: backport-compilation-error-with-Ruby-3.0.patch
Patch6031: backport-build-failure-with-Ruby-3.0-and-32-bits.patch
Patch6032: backport-missing-error-message.patch
Patch6033: backport-fix-giving-the-error-0-more-files-to-edit.patch
Patch6034: backport-add-the-arglist_locked-flag.patch
Patch6035: backport-CVE-2021-4166.patch
Patch6036: backport-fix-arglist-test-fails.patch
Patch6037: backport-CVE-2021-4192.patch
Patch6038: backport-CVE-2021-4193.patch
Patch6039: backport-CVE-2022-0213.patch
Patch6040: backport-CVE-2022-0261.patch
Patch6041: backport-CVE-2022-0318.patch
Patch6042: backport-vim-fix-garbled-characters-display-when-file-name-ma.patch
Patch6043: backport-CVE-2022-0351.patch
Patch6044: backport-CVE-2022-0408.patch
Patch6045: backport-CVE-2022-0361.patch
Patch6046: backport-CVE-2022-0359.patch
Patch6047: backport-CVE-2022-0413.patch
Patch6048: backport-CVE-2022-0368.patch
Patch6049: backport-CVE-2022-0443.patch
Patch6050: backport-CVE-2022-0392.patch
Patch6051: backport-invalid-argument-errmsg.patch
Patch6052: backport-CVE-2022-0417.patch
Patch6053: backport-crash-when-pasting-too-many-times.patch
Patch6054: backport-CVE-2022-0572.patch
Patch6055: backport-CVE-2022-0629.patch
Patch6056: backport-CVE-2022-0714.patch
Patch6057: backport-CVE-2022-0729.patch
Patch6058: backport-CVE-2022-0685.patch
Patch6059: backport-CVE-2022-0319.patch
Patch6060: backport-CVE-2022-0554.patch
Patch6061: backport-CVE-2022-0943.patch
Patch6062: backport-CVE-2022-1616.patch
Patch6063: backport-CVE-2022-1154.patch
Patch6064: backport-html-text-objects-are-not-fully-tested.patch
Patch6065: backport-CVE-2022-1629.patch
Patch6066: backport-insufficient-code-coverage-for-ex_docmd.c_functions.patch
Patch6067: backport-CVE-2022-1620.patch
Patch6068: backport-CVE-2022-1674.patch
Patch6069: backport-CVE-2022-1621.patch
Patch6070: backport-spell-test-fails-because-of-new-illegal-byte-check.patch
Patch6071: backport-command-line-editing-not-sufficiently-tested.patch
Patch6072: backport-CVE-2022-1619.patch
Patch6073: backport-CVE-2022-1733.patch
Patch6074: backport-CVE-2022-1735.patch
Patch6075: backport-CVE-2022-1771.patch
Patch6076: backport-CVE-2022-2124.patch
Patch9000: bugfix-rm-modify-info-version.patch
@ -420,6 +336,7 @@ popd
%{_datadir}/%{name}/%{vimdir}/{*.vim,ftplugin,indent,keymap,macros,plugin}
%{_datadir}/%{name}/%{vimdir}/{print,syntax,tutor,spell}
%{_datadir}/%{name}/%{vimdir}/lang/{*.vim,*.txt}
%{_datadir}/%{name}/%{vimdir}/import/dist/vimhelp.vim
%{_bindir}/xxd
%lang(af) %{_datadir}/%{name}/%{vimdir}/lang/af
%lang(ca) %{_datadir}/%{name}/%{vimdir}/lang/ca
@ -469,6 +386,9 @@ popd
%lang(ja) %{_mandir}/ja/man1/*
%lang(pl) %{_mandir}/pl/man1/*
%lang(ru) %{_mandir}/ru/man1/*
%lang(tr) %{_mandir}/tr/man1/*
%lang(tr.ISO8859-9) %{_mandir}/tr.ISO8859-9/man1/*
%lang(tr.UTF-8) %{_mandir}/tr.UTF-8/man1/*
%{_mandir}/man1/{gex.*,gview.*,gvim*,rvim.*,vim.*,vimdiff.*}
%{_mandir}/man1/{vimtutor.*,vimx.*,xxd.*}
%{_mandir}/man5/vimrc.*
@ -498,6 +418,12 @@ popd
%{_mandir}/man1/evim.*
%changelog
* Tue Jul 05 2022 shixuantong <shixuantong@h-partners.com> - 2:9.0-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:upgrade version to 9.0
* Thu Jun 23 2022 liukuo <liukuo@kylinos.cn> - 2:8.2-39
- Type:CVE
- ID:CVE-2022-2124