From c0951a18abc2f7706d70e082146360e7531e3b44 Mon Sep 17 00:00:00 2001 From: wangjiang Date: Thu, 29 Dec 2022 17:13:32 +0800 Subject: [PATCH] fix garbled characters display by vim in tar file and memory leak --- ...-of-typeahead-buf-that-is-not-filled.patch | 26 +++++++++++++ ...characters-display-when-file-name-ma.patch | 37 +++++++++++++++++++ vim.spec | 11 +++++- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 backport-patch-9.0.0024-may-access-part-of-typeahead-buf-that-is-not-filled.patch create mode 100644 backport-vim-fix-garbled-characters-display-when-file-name-ma.patch diff --git a/backport-patch-9.0.0024-may-access-part-of-typeahead-buf-that-is-not-filled.patch b/backport-patch-9.0.0024-may-access-part-of-typeahead-buf-that-is-not-filled.patch new file mode 100644 index 0000000..18ab1a4 --- /dev/null +++ b/backport-patch-9.0.0024-may-access-part-of-typeahead-buf-that-is-not-filled.patch @@ -0,0 +1,26 @@ +From af043e12d9e5869c597de40b9a2517ae97ac72e7 Mon Sep 17 00:00:00 2001 +From: Bram Moolenaar +Date: Sat, 2 Jul 2022 12:08:16 +0100 +Subject: [PATCH] patch 9.0.0024: may access part of typeahead buf that isn't + filled + +Problem: May access part of typeahead buf that isn't filled. +Solution: Check length of typeahead. +--- + src/getchar.c | 3 ++- + files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/getchar.c b/src/getchar.c +index 210a67acad59..12fd1c9146b3 100644 +--- a/src/getchar.c ++++ b/src/getchar.c +@@ -2437,7 +2437,8 @@ handle_mapping( + int is_plug_map = FALSE; + + // If typehead starts with then remap, even for a "noremap" mapping. +- if (typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL ++ if (typebuf.tb_len >= 3 ++ && typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL + && typebuf.tb_buf[typebuf.tb_off + 1] == KS_EXTRA + && typebuf.tb_buf[typebuf.tb_off + 2] == KE_PLUG) + is_plug_map = TRUE; diff --git a/backport-vim-fix-garbled-characters-display-when-file-name-ma.patch b/backport-vim-fix-garbled-characters-display-when-file-name-ma.patch new file mode 100644 index 0000000..7ba3877 --- /dev/null +++ b/backport-vim-fix-garbled-characters-display-when-file-name-ma.patch @@ -0,0 +1,37 @@ +From 41a04f3129db7e12641642e3071e909111ba503b Mon Sep 17 00:00:00 2001 +From: wangjiang +Date: Thu, 29 Dec 2022 16:09:17 +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: wangjiang +--- + 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 e495e82..64ba858 100644 +--- a/runtime/autoload/tar.vim ++++ b/runtime/autoload/tar.vim +@@ -208,7 +208,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 +-- +2.33.0 + diff --git a/vim.spec b/vim.spec index 98d27a2..e95717a 100644 --- a/vim.spec +++ b/vim.spec @@ -12,7 +12,7 @@ Name: vim Epoch: 2 Version: 9.0 -Release: 5 +Release: 6 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 @@ -81,6 +81,8 @@ Patch6051: backport-patch-9.0.0790-test-for-dummy-buffer-does-not-always.pa Patch6052: backport-CVE-2022-4292.patch Patch6053: backport-patch-9.0.0712-wrong-column-when-calling-setcursorch-with-zero-lnum.patch Patch6054: backport-CVE-2022-4293.patch +Patch6055: backport-vim-fix-garbled-characters-display-when-file-name-ma.patch +Patch6056: backport-patch-9.0.0024-may-access-part-of-typeahead-buf-that-is-not-filled.patch Patch9000: bugfix-rm-modify-info-version.patch @@ -488,6 +490,13 @@ LC_ALL=en_US.UTF-8 make -j1 test %{_mandir}/man1/evim.* %changelog +* Thu Dec 29 2022 wangjiang - 2:9.0-6 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix garbled characters display when file name matches warning or error in tar file + fix memory leak + * Mon Dec 12 2022 wangjiang - 2:9.0-5 - Type:bugfix - ID:NA -- Gitee