From f27350b5f2da6bbb222e2aa252ead7bcdb115173 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jan 19 2022 21:26:22 +0000 Subject: import vim-8.0.1763-16.el8_5.4 --- diff --git a/SOURCES/0001-patch-8.2.3949-using-freed-memory-with-V.patch b/SOURCES/0001-patch-8.2.3949-using-freed-memory-with-V.patch new file mode 100644 index 0000000..c3f7bb1 --- /dev/null +++ b/SOURCES/0001-patch-8.2.3949-using-freed-memory-with-V.patch @@ -0,0 +1,45 @@ +diff -up vim80/src/regexp.c.cve4192 vim80/src/regexp.c +--- vim80/src/regexp.c.cve4192 2022-01-12 15:21:44.792239040 +0100 ++++ vim80/src/regexp.c 2022-01-12 15:34:35.190425880 +0100 +@@ -4203,9 +4203,9 @@ reg_match_visual(void) + if (lnum < top.lnum || lnum > bot.lnum) + return FALSE; + ++ col = (colnr_T)(reginput - regline); + if (mode == 'v') + { +- col = (colnr_T)(reginput - regline); + if ((lnum == top.lnum && col < top.col) + || (lnum == bot.lnum && col >= bot.col + (*p_sel != 'e'))) + return FALSE; +@@ -4220,7 +4220,12 @@ reg_match_visual(void) + end = end2; + if (top.col == MAXCOL || bot.col == MAXCOL) + end = MAXCOL; +- cols = win_linetabsize(wp, regline, (colnr_T)(reginput - regline)); ++ ++ // getvvcol() flushes rex.line, need to get it again ++ regline = reg_getline(reglnum); ++ reginput = regline + col; ++ ++ cols = win_linetabsize(wp, regline, col); + if (cols < start || cols > end - (*p_sel == 'e')) + return FALSE; + } +diff -up vim80/src/testdir/test_regexp_latin.vim.cve4192 vim80/src/testdir/test_regexp_latin.vim +--- vim80/src/testdir/test_regexp_latin.vim.cve4192 2022-01-12 15:21:44.792239040 +0100 ++++ vim80/src/testdir/test_regexp_latin.vim 2022-01-12 15:36:12.499693099 +0100 +@@ -80,3 +80,13 @@ func Test_using_invalid_visual_position( + /\%V + bwipe! + endfunc ++ ++func Test_using_visual_position() ++ " this was using freed memory ++ new ++ exe "norm 0o\\k\o0" ++ /\%V ++ bwipe! ++endfunc ++ ++" vim: shiftwidth=2 sts=2 expandtab diff --git a/SOURCES/0001-patch-8.2.3950-going-beyond-the-end-of-the-line-with.patch b/SOURCES/0001-patch-8.2.3950-going-beyond-the-end-of-the-line-with.patch new file mode 100644 index 0000000..485f00d --- /dev/null +++ b/SOURCES/0001-patch-8.2.3950-going-beyond-the-end-of-the-line-with.patch @@ -0,0 +1,38 @@ +diff -up vim80/src/charset.c.cve4193 vim80/src/charset.c +--- vim80/src/charset.c.cve4193 2022-01-12 14:49:08.710592947 +0100 ++++ vim80/src/charset.c 2022-01-12 14:49:47.594705863 +0100 +@@ -1291,10 +1291,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; + #ifdef FEAT_MBYTE + if (has_mbyte) +diff -up vim80/src/testdir/test_regexp_latin.vim.cve4193 vim80/src/testdir/test_regexp_latin.vim +--- vim80/src/testdir/test_regexp_latin.vim.cve4193 2022-01-12 14:49:08.710592947 +0100 ++++ vim80/src/testdir/test_regexp_latin.vim 2022-01-12 14:50:45.186873107 +0100 +@@ -72,3 +72,11 @@ func Test_backref() + call assert_fails('call search("\\%#=2\\(e\\1\\)")', 'E65:') + bwipe! + endfunc ++ ++func Test_using_invalid_visual_position() ++ " this was going beyond the end of the line ++ new ++ exe "norm 0o000\0\$s0" ++ /\%V ++ bwipe! ++endfunc diff --git a/SPECS/vim.spec b/SPECS/vim.spec index 03efc9b..0c0402a 100644 --- a/SPECS/vim.spec +++ b/SPECS/vim.spec @@ -24,7 +24,7 @@ Summary: The VIM editor URL: http://www.vim.org/ Name: vim Version: %{baseversion}.%{patchlevel} -Release: 16%{?dist}.3 +Release: 16%{?dist}.4 License: Vim and MIT Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2 Source1: vim.sh @@ -84,6 +84,10 @@ Patch3024: 0001-patch-8.2.3487-illegal-memory-access-if-buffer-name-.patch Patch3025: 0001-patch-8.2.3625-illegal-memory-access-when-C-indentin.patch # 2028430 - CVE-2021-4019 vim: heap-based buffer overflow in find_help_tags() in src/help.c [rhel-8.6.0] Patch3026: 0001-patch-8.2.3669-buffer-overflow-with-long-help-argume.patch +# CVE-2021-4193 vim: vulnerable to Out-of-bounds Read +Patch3027: 0001-patch-8.2.3950-going-beyond-the-end-of-the-line-with.patch +# CVE-2021-4192 vim: vulnerable to Use After Free +Patch3028: 0001-patch-8.2.3949-using-freed-memory-with-V.patch # gcc is no longer in buildroot by default BuildRequires: gcc @@ -287,6 +291,8 @@ perl -pi -e "s,bin/nawk,bin/awk,g" runtime/tools/mve.awk %patch3024 -p1 -b .cve3872 %patch3025 -p1 -b .cve3984 %patch3026 -p1 -b .cve4019 +%patch3027 -p1 -b .cve4193 +%patch3028 -p1 -b .cve4192 %build %if 0%{?rhel} > 7 @@ -805,6 +811,10 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags %{_datadir}/icons/locolor/*/apps/* %changelog +* Wed Jan 12 2022 Zdenek Dohnal - 2:8.0.1763-16.4 +- CVE-2021-4193 vim: vulnerable to Out-of-bounds Read +- CVE-2021-4192 vim: vulnerable to Use After Free + * Fri Dec 03 2021 Zdenek Dohnal - 2:8.0.1763-16.3 - 2028341 - CVE-2021-3984 vim: illegal memory access when C-indenting could lead to Heap Buffer Overflow [rhel-8.6.0] - 2028430 - CVE-2021-4019 vim: heap-based buffer overflow in find_help_tags() in src/help.c [rhel-8.6.0]