From 73f066f207c66a3601fa5a03e8eb98fa5eb7549a Mon Sep 17 00:00:00 2001 From: weiwei_tiantian Date: Tue, 5 Jul 2022 10:42:12 +0800 Subject: [PATCH] fix CVE-2022-2207 --- backport-CVE-2022-2207.patch | 29 +++++++++++++++++++++++++++++ vim.spec | 9 ++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 backport-CVE-2022-2207.patch diff --git a/backport-CVE-2022-2207.patch b/backport-CVE-2022-2207.patch new file mode 100644 index 0000000..613cc38 --- /dev/null +++ b/backport-CVE-2022-2207.patch @@ -0,0 +1,29 @@ +From 0971c7a4e537ea120a6bb2195960be8d0815e97b Mon Sep 17 00:00:00 2001 +From: Bram Moolenaar +Date: Sun, 26 Jun 2022 12:59:02 +0100 +Subject: [PATCH] patch 8.2.5162: reading before the start of the line with BS + in Replace mode + +Problem: Reading before the start of the line with BS in Replace mode. +Solution: Check the cursor column is more than zero. + +--- + src/edit.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/edit.c b/src/edit.c +index c4ede2b..bc0b7dc 100644 +--- a/src/edit.c ++++ b/src/edit.c +@@ -4761,7 +4761,7 @@ ins_bs( + #endif + + // delete characters until we are at or before want_vcol +- while (vcol > want_vcol ++ while (vcol > want_vcol && curwin->w_cursor.col > 0 + && (cc = *(ml_get_cursor() - 1), VIM_ISWHITE(cc))) + ins_bs_one(&vcol); + +-- +2.27.0 + diff --git a/vim.spec b/vim.spec index 267d448..deed561 100644 --- a/vim.spec +++ b/vim.spec @@ -12,7 +12,7 @@ Name: vim Epoch: 2 Version: 8.2 -Release: 46 +Release: 47 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 @@ -129,6 +129,7 @@ Patch6092: backport-patch-8.2.1354-test-59-is-old-style.patch Patch6093: backport-patch-8.2.3484-crash-when-going-through-spell-sugges.patch Patch6094: backport-patch-8.2.5007-spell-suggestion-may-use-uninitialize.patch Patch6095: backport-CVE-2022-2126.patch +Patch6096: backport-CVE-2022-2207.patch Patch9000: bugfix-rm-modify-info-version.patch @@ -517,6 +518,12 @@ popd %{_mandir}/man1/evim.* %changelog +* Tue Jul 05 2022 tianwei - 2:8.2-47 +- Type:CVE +- ID:CVE-2022-2207 +- SUG:NA +- DESC:fix CVE-2022-2207 + * Wed Jun 29 2022 shixuantong - 2:8.2-46 - Type:CVE - ID:CVE-2022-2126 -- Gitee