Accepting request 1079500 from home:gladiac:branches:editors
- Update to version 0.9.0 * For notable changes see `:help news` - Remove snprintf-buf-ovrflw-FORTIFY-3.patch OBS-URL: https://build.opensuse.org/request/show/1079500 OBS-URL: https://build.opensuse.org/package/show/editors/neovim?expand=0&rev=129
This commit is contained in:
parent
f32fd91485
commit
534a66aa5b
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:adf45ff160e1d89f519b6114732eba03485ae469beb27919b0f7a4f6b44233c1
|
|
||||||
size 11406282
|
|
3
neovim-0.9.0.tar.gz
Normal file
3
neovim-0.9.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:39d79107c54d2f3babcad2cd157c399241c04f6e75e98c18e8afaf2bb5e82937
|
||||||
|
size 11549103
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Apr 14 17:13:38 UTC 2023 - Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
|
||||||
|
- Update to version 0.9.0
|
||||||
|
* For notable changes see `:help news`
|
||||||
|
- Remove snprintf-buf-ovrflw-FORTIFY-3.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Mar 27 11:42:39 UTC 2023 - Matej Cepl <mcepl@suse.com>
|
Mon Mar 27 11:42:39 UTC 2023 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
123
neovim.spec
123
neovim.spec
@ -16,17 +16,37 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
%define luv_min_ver 1.30.0
|
%{?!python3_pkgversion:%define python3_pkgversion 3}
|
||||||
|
|
||||||
|
# %%undefine _build_create_debug \
|
||||||
|
# %%define __arch_install_post export NO_BRP_STRIP_DEBUG=true
|
||||||
|
|
||||||
|
%if 0%{?rhel}
|
||||||
|
%define __cmake cmake3
|
||||||
|
BuildRequires: cmake3
|
||||||
|
%else
|
||||||
|
BuildRequires: cmake
|
||||||
|
%endif
|
||||||
|
%if 0%{?rhel} || 0%{?fedora}
|
||||||
|
%define vimplugin_dir %{_datadir}/vim/vimfiles
|
||||||
|
%else
|
||||||
|
%define vimplugin_dir %{_datadir}/vim/site
|
||||||
|
%endif
|
||||||
|
%if 0%{?fedora}
|
||||||
|
%define lua_archdir %{lua_libdir}
|
||||||
|
%define lua_noarchdir %{lua_pkgdir}
|
||||||
|
%define lua_incdir %{_includedir}/lua-%{lua_version}
|
||||||
|
Requires: python3-neovim
|
||||||
|
%bcond_with luajit
|
||||||
|
%endif
|
||||||
# Luajit not available on all platforms
|
# Luajit not available on all platforms
|
||||||
%ifarch %{arm} %{ix86} x86_64 aarch64
|
%ifarch %{arm} %{ix86} x86_64 aarch64
|
||||||
%bcond_without luajit
|
%bcond_without luajit
|
||||||
%else
|
%else
|
||||||
%bcond_with luajit
|
%bcond_with luajit
|
||||||
%endif
|
%endif
|
||||||
%define luaver 5.1
|
|
||||||
%define luaver_nopoint 51
|
|
||||||
Name: neovim
|
Name: neovim
|
||||||
Version: 0.8.3
|
Version: 0.9.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Vim-fork focused on extensibility and agility
|
Summary: Vim-fork focused on extensibility and agility
|
||||||
License: Apache-2.0 AND Vim
|
License: Apache-2.0 AND Vim
|
||||||
@ -40,10 +60,6 @@ Source3: suse-spec-template
|
|||||||
# we need /usr/bin/luajit. Fake it.
|
# we need /usr/bin/luajit. Fake it.
|
||||||
Source10: lj-busted.sh
|
Source10: lj-busted.sh
|
||||||
Source99: neovim-rpmlintrc
|
Source99: neovim-rpmlintrc
|
||||||
# PATCH-FIX-UPSTREAM snprintf-buf-ovrflw-FORTIFY-3.patch gh#neovim/neovim#22779 mcepl@suse.com
|
|
||||||
# fix snprintf buffer overflow (crash on :he)
|
|
||||||
Patch0: snprintf-buf-ovrflw-FORTIFY-3.patch
|
|
||||||
BuildRequires: cmake
|
|
||||||
BuildRequires: desktop-file-utils
|
BuildRequires: desktop-file-utils
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: filesystem
|
BuildRequires: filesystem
|
||||||
@ -52,45 +68,47 @@ BuildRequires: gettext
|
|||||||
BuildRequires: git-core
|
BuildRequires: git-core
|
||||||
BuildRequires: gperf
|
BuildRequires: gperf
|
||||||
BuildRequires: hicolor-icon-theme
|
BuildRequires: hicolor-icon-theme
|
||||||
BuildRequires: libtermkey-devel
|
|
||||||
BuildRequires: libtool
|
BuildRequires: libtool
|
||||||
BuildRequires: libuv-devel
|
|
||||||
BuildRequires: libvterm-devel >= 0.3
|
|
||||||
BuildRequires: lua-macros
|
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
BuildRequires: msgpack-c-devel
|
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
BuildRequires: tree-sitter-devel
|
|
||||||
BuildRequires: unibilium-devel
|
|
||||||
BuildRequires: unzip
|
BuildRequires: unzip
|
||||||
BuildRequires: update-desktop-files
|
BuildRequires: pkgconfig(libutf8proc)
|
||||||
|
BuildRequires: pkgconfig(libuv) >= 1.42.0
|
||||||
|
BuildRequires: pkgconfig(msgpack)
|
||||||
|
BuildRequires: pkgconfig(termkey)
|
||||||
|
BuildRequires: pkgconfig(tree-sitter) >= 0.20.8
|
||||||
|
BuildRequires: pkgconfig(unibilium)
|
||||||
|
BuildRequires: pkgconfig(vterm) >= 0.3
|
||||||
Requires: gperf
|
Requires: gperf
|
||||||
Requires: libvterm0 >= 0.3
|
Requires: libvterm0 >= 0.3
|
||||||
Recommends: python3-neovim
|
Requires: xdg-utils
|
||||||
Requires(post): desktop-file-utils
|
|
||||||
Requires(postun):desktop-file-utils
|
Recommends: wl-clipboard
|
||||||
# XSel provides access to the system clipboard
|
|
||||||
Recommends: xsel
|
Recommends: xsel
|
||||||
|
|
||||||
|
%if 0%{?suse_version}
|
||||||
|
BuildRequires: libluv-devel
|
||||||
|
BuildRequires: lua-macros
|
||||||
|
BuildRequires: lua51-LPeg
|
||||||
|
BuildRequires: lua51-bit32
|
||||||
|
BuildRequires: lua51-luarocks
|
||||||
|
BuildRequires: lua51-luv
|
||||||
|
BuildRequires: lua51-mpack
|
||||||
%if %{with luajit}
|
%if %{with luajit}
|
||||||
BuildRequires: luajit-devel
|
BuildRequires: luajit-devel
|
||||||
%else
|
%else
|
||||||
BuildRequires: lua51-BitOp
|
BuildRequires: lua51-BitOp
|
||||||
BuildRequires: lua51-devel
|
BuildRequires: lua51-devel
|
||||||
%endif
|
%endif
|
||||||
# luajit implements version 5.1 of the lua language spec, so it needs the
|
Requires: lua51-bit32
|
||||||
# compat versions of libs.
|
Requires: lua51-luv
|
||||||
BuildRequires: lua51-LPeg
|
Recommends: python3-neovim
|
||||||
BuildRequires: libluv-devel >= %{luv_min_ver}
|
|
||||||
BuildRequires: lua51-luarocks
|
|
||||||
BuildRequires: lua51-luv >= %{luv_min_ver}
|
|
||||||
BuildRequires: lua51-mpack
|
|
||||||
Requires: lua51-luv >= %{luv_min_ver}
|
|
||||||
%if 0%{?suse_version} < 1330
|
%if 0%{?suse_version} < 1330
|
||||||
BuildRequires: hicolor-icon-theme
|
|
||||||
Requires(post): gtk3-tools
|
Requires(post): gtk3-tools
|
||||||
Requires(postun):gtk3-tools
|
Requires(postun):gtk3-tools
|
||||||
%endif
|
%endif
|
||||||
|
%endif
|
||||||
%if 0%{?suse_version} > 1500
|
%if 0%{?suse_version} > 1500
|
||||||
# Modern *SUSE … tests are enabled
|
# Modern *SUSE … tests are enabled
|
||||||
# For tests
|
# For tests
|
||||||
@ -98,6 +116,23 @@ BuildRequires: lua51-busted
|
|||||||
BuildRequires: hostname
|
BuildRequires: hostname
|
||||||
# end of test requirements
|
# end of test requirements
|
||||||
%endif
|
%endif
|
||||||
|
%if 0%{?rhel} || 0%{?fedora}
|
||||||
|
BuildRequires: lua-bit32
|
||||||
|
BuildRequires: lua-devel
|
||||||
|
BuildRequires: lua-lpeg
|
||||||
|
BuildRequires: lua-luv-devel
|
||||||
|
BuildRequires: lua-mpack
|
||||||
|
BuildRequires: luarocks
|
||||||
|
BuildRequires: python2-six
|
||||||
|
Requires: lua-luv
|
||||||
|
%endif
|
||||||
|
%if 0%{?rhel}
|
||||||
|
BuildRequires: lua-bit32
|
||||||
|
BuildRequires: lua-macros
|
||||||
|
BuildRequires: luajit-devel
|
||||||
|
Requires: lua-bit32
|
||||||
|
Requires: python34-neovim
|
||||||
|
%endif
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Neovim is a refactor - and sometimes redactor - in the tradition of
|
Neovim is a refactor - and sometimes redactor - in the tradition of
|
||||||
@ -137,19 +172,21 @@ export CXXFLAGS="%{optflags} -fcommon"
|
|||||||
-DLUA_PRG=%{_bindir}/%{?with_luajit:luajit}%{!?with_luajit:lua} \
|
-DLUA_PRG=%{_bindir}/%{?with_luajit:luajit}%{!?with_luajit:lua} \
|
||||||
%if %{with luajit}
|
%if %{with luajit}
|
||||||
-DBUSTED_PRG="$(readlink -f ../lj-busted.sh)" \
|
-DBUSTED_PRG="$(readlink -f ../lj-busted.sh)" \
|
||||||
|
-DLUAJIT_INCLUDE_DIR:PATH=%(pkgconf --cflags-only-I luajit|cut -c 3-) \
|
||||||
%endif
|
%endif
|
||||||
-DUSE_BUNDLED=OFF -DLUAJIT_USE_BUNDLED=ON \
|
-DUSE_BUNDLED=OFF -DLUAJIT_USE_BUNDLED=ON \
|
||||||
-DCMAKE_SKIP_RPATH=ON -DCMAKE_VERBOSE_MAKEFILE=ON \
|
-DCMAKE_SKIP_RPATH=ON -DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||||
-DUSE_BUNDLED=OFF -DLUAJIT_USE_BUNDLED=OFF \
|
|
||||||
-DCMAKE_COLOR_MAKEFILE=OFF \
|
-DCMAKE_COLOR_MAKEFILE=OFF \
|
||||||
-DCMAKE_C_FLAGS_RELWITHDEBINFO="$opts" \
|
-DCMAKE_C_FLAGS_RELWITHDEBINFO="$opts" \
|
||||||
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
|
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
|
||||||
-DLUA_INCLUDE_DIR:PATH=%{lua_incdir}
|
-DLIBLUV_INCLUDE_DIR:PATH=%{lua_incdir} \
|
||||||
|
# -DLIBLUV_LIBRARY=%{lua_archdir}/luv.so
|
||||||
%make_build
|
%make_build
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
%{?!cmake_install:%define cmake_install DESTDIR=%{buildroot} make install -C build}
|
||||||
%cmake_install
|
%cmake_install
|
||||||
|
|
||||||
# system-wide configuration file
|
# system-wide configuration file
|
||||||
@ -162,7 +199,8 @@ install -p -m 644 %{SOURCE3} %{buildroot}%{_datadir}/nvim/template.spec
|
|||||||
install -p -m 644 %{SOURCE2} %{buildroot}%{_datadir}/nvim/template.spec
|
install -p -m 644 %{SOURCE2} %{buildroot}%{_datadir}/nvim/template.spec
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%suse_update_desktop_file -r nvim ConsoleOnly Application Utility TextEditor
|
desktop-file-install --dir=%{buildroot}%{_datadir}/applications \
|
||||||
|
runtime/nvim.desktop
|
||||||
install -d -m0755 %{buildroot}%{_datadir}/pixmaps
|
install -d -m0755 %{buildroot}%{_datadir}/pixmaps
|
||||||
install -m0644 runtime/nvim.png %{buildroot}%{_datadir}/pixmaps/nvim.png
|
install -m0644 runtime/nvim.png %{buildroot}%{_datadir}/pixmaps/nvim.png
|
||||||
|
|
||||||
@ -181,7 +219,6 @@ mkdir -p %{buildroot}%{vimplugin_dir}/{after,after/syntax,autoload,colors,doc,ft
|
|||||||
export NO_BRP_CHECK_RPATH=true
|
export NO_BRP_CHECK_RPATH=true
|
||||||
|
|
||||||
%check
|
%check
|
||||||
# Unit tests require the ffi module which is only available with luajit
|
|
||||||
%if %{with luajit}
|
%if %{with luajit}
|
||||||
# Tests fail on aarch64 gh#neovim/neovim#18176
|
# Tests fail on aarch64 gh#neovim/neovim#18176
|
||||||
%ifnarch aarch64
|
%ifnarch aarch64
|
||||||
@ -194,13 +231,13 @@ popd
|
|||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?suse_version} < 1330
|
%if 0%{?suse_version} && 0%{?suse_version} < 1330
|
||||||
%post
|
%post
|
||||||
%desktop_database_post
|
%desktop_database_post
|
||||||
%icon_theme_cache_post
|
%icon_theme_cache_post
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?suse_version} < 1330
|
%if 0%{?suse_version} && 0%{?suse_version} < 1330
|
||||||
%postun
|
%postun
|
||||||
%desktop_database_postun
|
%desktop_database_postun
|
||||||
%icon_theme_cache_postun
|
%icon_theme_cache_postun
|
||||||
@ -208,19 +245,23 @@ popd
|
|||||||
|
|
||||||
%files
|
%files
|
||||||
%doc BACKERS.md CONTRIBUTING.md README.md
|
%doc BACKERS.md CONTRIBUTING.md README.md
|
||||||
|
%docdir %{_mandir}
|
||||||
%license LICENSE.txt
|
%license LICENSE.txt
|
||||||
%{_bindir}/nvim
|
%{_bindir}/nvim
|
||||||
%{_datadir}/nvim/
|
|
||||||
%{_datadir}/applications/nvim.desktop
|
|
||||||
%{_datadir}/pixmaps/nvim.png
|
|
||||||
%{_datadir}/icons/hicolor/*/apps/nvim.png
|
|
||||||
%{_mandir}/man1/nvim.1%{?ext_man}
|
%{_mandir}/man1/nvim.1%{?ext_man}
|
||||||
|
%dir %{_datadir}/nvim
|
||||||
|
%{_datadir}/nvim/sysinit.vim
|
||||||
|
%{_datadir}/nvim/template.spec
|
||||||
|
%{_datadir}/nvim/runtime/
|
||||||
|
%{_datadir}/applications/*
|
||||||
|
%{_datadir}/pixmaps/*
|
||||||
|
%{_datadir}/icons/*
|
||||||
%dir %{_sysconfdir}/nvim
|
%dir %{_sysconfdir}/nvim
|
||||||
%config(noreplace) %{_sysconfdir}/nvim/sysinit.vim
|
%config(noreplace) %{_sysconfdir}/nvim/sysinit.vim
|
||||||
%dir %{_datadir}/vim
|
%dir %{_datadir}/vim
|
||||||
%dir %{vimplugin_dir}/
|
%dir %{vimplugin_dir}
|
||||||
%dir %{vimplugin_dir}/after
|
%dir %{vimplugin_dir}/after
|
||||||
%dir %{vimplugin_dir}/after/syntax
|
%dir %{vimplugin_dir}/after/*
|
||||||
%dir %{vimplugin_dir}/autoload
|
%dir %{vimplugin_dir}/autoload
|
||||||
%dir %{vimplugin_dir}/colors
|
%dir %{vimplugin_dir}/colors
|
||||||
%dir %{vimplugin_dir}/doc
|
%dir %{vimplugin_dir}/doc
|
||||||
|
@ -1,206 +0,0 @@
|
|||||||
From a4640cc51fda6b5688c9b79c2d4d7d19e6d758a3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Andreas Schneider <asn@cryptomilk.org>
|
|
||||||
Date: Sat, 25 Mar 2023 11:26:36 +0100
|
|
||||||
Subject: [PATCH 1/2] fix: snprintf buffer overflow detected by
|
|
||||||
-D_FORTIFY_SOURCE=3
|
|
||||||
|
|
||||||
Thread no. 1 (24 frames)
|
|
||||||
#8 snprintf at /usr/include/bits/stdio2.h:54
|
|
||||||
#9 set_cmdarg at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/eval.c:7044
|
|
||||||
#10 apply_autocmds_group at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/autocmd.c:1843
|
|
||||||
#11 apply_autocmds_exarg at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/autocmd.c:1549
|
|
||||||
#12 readfile at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/fileio.c:617
|
|
||||||
#13 buf_reload at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/fileio.c:5038
|
|
||||||
#14 buf_check_timestamp at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/fileio.c:4952
|
|
||||||
#15 check_timestamps at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/fileio.c:4678
|
|
||||||
#16 ex_checktime at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/ex_cmds2.c:765
|
|
||||||
#17 execute_cmd0 at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/ex_docmd.c:1620
|
|
||||||
#18 do_one_cmd at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/ex_docmd.c:2275
|
|
||||||
#19 do_cmdline at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/ex_docmd.c:584
|
|
||||||
#20 ex_execute at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/eval.c:7727
|
|
||||||
#21 execute_cmd0 at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/ex_docmd.c:1620
|
|
||||||
#22 do_one_cmd at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/ex_docmd.c:2275
|
|
||||||
#23 do_cmdline at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/ex_docmd.c:584
|
|
||||||
#24 do_ucmd at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/usercmd.c:1661
|
|
||||||
#25 execute_cmd0 at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/ex_docmd.c:1612
|
|
||||||
#26 do_one_cmd at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/ex_docmd.c:2275
|
|
||||||
#27 do_cmdline at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/ex_docmd.c:584
|
|
||||||
#28 nv_colon at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/normal.c:4058
|
|
||||||
#29 normal_execute at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/normal.c:1172
|
|
||||||
#30 state_enter at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/state.c:88
|
|
||||||
#31 normal_enter at /usr/src/debug/neovim-0.8.2-2.fc38.x86_64/src/nvim/normal.c:471
|
|
||||||
|
|
||||||
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
|
|
||||||
---
|
|
||||||
src/nvim/eval.c | 73 +++++++++++++++++++++++++++++++++++++------------
|
|
||||||
1 file changed, 55 insertions(+), 18 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
|
|
||||||
index cd76d110887ee..c652d9507a592 100644
|
|
||||||
--- a/src/nvim/eval.c
|
|
||||||
+++ b/src/nvim/eval.c
|
|
||||||
@@ -6999,20 +6999,18 @@ char *set_cmdarg(exarg_T *eap, char *oldarg)
|
|
||||||
{
|
|
||||||
char *oldval = vimvars[VV_CMDARG].vv_str;
|
|
||||||
if (eap == NULL) {
|
|
||||||
- xfree(oldval);
|
|
||||||
- vimvars[VV_CMDARG].vv_str = oldarg;
|
|
||||||
- return NULL;
|
|
||||||
+ goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t len = 0;
|
|
||||||
if (eap->force_bin == FORCE_BIN) {
|
|
||||||
- len = 6;
|
|
||||||
+ len += 6; // " ++bin"
|
|
||||||
} else if (eap->force_bin == FORCE_NOBIN) {
|
|
||||||
- len = 8;
|
|
||||||
+ len += 8; // " ++nobin"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eap->read_edit) {
|
|
||||||
- len += 7;
|
|
||||||
+ len += 7; // " ++edit"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eap->force_ff != 0) {
|
|
||||||
@@ -7027,38 +7025,77 @@ char *set_cmdarg(exarg_T *eap, char *oldarg)
|
|
||||||
|
|
||||||
const size_t newval_len = len + 1;
|
|
||||||
char *newval = xmalloc(newval_len);
|
|
||||||
+ size_t xlen = 0;
|
|
||||||
+ int rc = 0;
|
|
||||||
|
|
||||||
if (eap->force_bin == FORCE_BIN) {
|
|
||||||
- snprintf(newval, newval_len, " ++bin");
|
|
||||||
+ rc = snprintf(newval, newval_len, " ++bin");
|
|
||||||
} else if (eap->force_bin == FORCE_NOBIN) {
|
|
||||||
- snprintf(newval, newval_len, " ++nobin");
|
|
||||||
+ rc = snprintf(newval, newval_len, " ++nobin");
|
|
||||||
} else {
|
|
||||||
*newval = NUL;
|
|
||||||
}
|
|
||||||
+ if (rc < 0) {
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ xlen += (size_t)rc;
|
|
||||||
|
|
||||||
if (eap->read_edit) {
|
|
||||||
- STRCAT(newval, " ++edit");
|
|
||||||
+ rc = snprintf(newval + xlen, newval_len - xlen, " ++edit");
|
|
||||||
+ if (rc < 0) {
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ xlen += (size_t)rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eap->force_ff != 0) {
|
|
||||||
- snprintf(newval + strlen(newval), newval_len, " ++ff=%s",
|
|
||||||
- eap->force_ff == 'u' ? "unix" :
|
|
||||||
- eap->force_ff == 'd' ? "dos" : "mac");
|
|
||||||
+ rc = snprintf(newval + xlen,
|
|
||||||
+ newval_len - xlen,
|
|
||||||
+ " ++ff=%s",
|
|
||||||
+ eap->force_ff == 'u' ? "unix"
|
|
||||||
+ : eap->force_ff == 'd' ? "dos" : "mac");
|
|
||||||
+ if (rc < 0) {
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ xlen += (size_t)rc;
|
|
||||||
}
|
|
||||||
if (eap->force_enc != 0) {
|
|
||||||
- snprintf(newval + strlen(newval), newval_len, " ++enc=%s",
|
|
||||||
- eap->cmd + eap->force_enc);
|
|
||||||
+ rc = snprintf(newval + (xlen), newval_len - xlen, " ++enc=%s", eap->cmd + eap->force_enc);
|
|
||||||
+ if (rc < 0) {
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ xlen += (size_t)rc;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
if (eap->bad_char == BAD_KEEP) {
|
|
||||||
- STRCPY(newval + strlen(newval), " ++bad=keep");
|
|
||||||
+ rc = snprintf(newval + xlen, newval_len - xlen, " ++bad=keep");
|
|
||||||
+ if (rc < 0) {
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ xlen += (size_t)rc;
|
|
||||||
} else if (eap->bad_char == BAD_DROP) {
|
|
||||||
- STRCPY(newval + strlen(newval), " ++bad=drop");
|
|
||||||
+ rc = snprintf(newval + xlen, newval_len - xlen, " ++bad=drop");
|
|
||||||
+ if (rc < 0) {
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ xlen += (size_t)rc;
|
|
||||||
} else if (eap->bad_char != 0) {
|
|
||||||
- snprintf(newval + strlen(newval), newval_len, " ++bad=%c",
|
|
||||||
- eap->bad_char);
|
|
||||||
+ rc = snprintf(newval + xlen, newval_len - xlen, " ++bad=%c", eap->bad_char);
|
|
||||||
+ if (rc < 0) {
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ xlen += (size_t)rc;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ assert(xlen <= newval_len);
|
|
||||||
+
|
|
||||||
vimvars[VV_CMDARG].vv_str = newval;
|
|
||||||
return oldval;
|
|
||||||
+
|
|
||||||
+error:
|
|
||||||
+ xfree(oldval);
|
|
||||||
+ vimvars[VV_CMDARG].vv_str = oldarg;
|
|
||||||
+ return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check if variable "name[len]" is a local variable or an argument.
|
|
||||||
|
|
||||||
From cb90257a9f6c052878cf40f819bb260865fcad4d Mon Sep 17 00:00:00 2001
|
|
||||||
From: koeleck <779769+koeleck@users.noreply.github.com>
|
|
||||||
Date: Sun, 19 Mar 2023 22:32:37 +0100
|
|
||||||
Subject: [PATCH 2/2] fix: invalid buffer size argument to snprintf #22729
|
|
||||||
|
|
||||||
Problem:
|
|
||||||
Crash in findtags_add_match with FORTIFY_SOURCE=3.
|
|
||||||
Note: Fedora 38 packages are now built with -D_FORTIFY_SOURCE=3 by default.
|
|
||||||
1. Compile with overflow protection.
|
|
||||||
2. nvim --clean
|
|
||||||
3. :h <Space> <Tab>
|
|
||||||
4. `*** overflow detected ***: terminated`
|
|
||||||
|
|
||||||
The additional checks for the stated buffer size and the actual bounds
|
|
||||||
of the buffer do not match. See `___snprintf_chk` in the glibc sources:
|
|
||||||
https://sourceware.org/git/?p=glibc.git;a=blob;f=debug/snprintf_chk.c;h=59577de076c570b81307dd31c8c73e265808cf4c;hb=HEAD#l28
|
|
||||||
|
|
||||||
Solution:
|
|
||||||
Fix arithmetic error: The length of the previously written data is now
|
|
||||||
subtracted from the total size of the buffer, instead of added on top.
|
|
||||||
|
|
||||||
close #22718
|
|
||||||
|
|
||||||
Backported by: Andreas Schneider <asn@cryptomilk.org>
|
|
||||||
---
|
|
||||||
src/nvim/tag.c | 5 +++--
|
|
||||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
|
|
||||||
index a8d8eebb0d02b..b2f89348d449c 100644
|
|
||||||
--- a/src/nvim/tag.c
|
|
||||||
+++ b/src/nvim/tag.c
|
|
||||||
@@ -2029,13 +2029,14 @@ int find_tags(char *pat, int *num_matches, char ***matchesp, int flags, int minc
|
|
||||||
// The format is {tagname}@{lang}NUL{heuristic}NUL
|
|
||||||
*tagp.tagname_end = NUL;
|
|
||||||
len = (size_t)(tagp.tagname_end - (char_u *)tagp.tagname);
|
|
||||||
- mfp = xmalloc(sizeof(char) + len + 10 + ML_EXTRA + 1);
|
|
||||||
+ size_t mfp_size = sizeof(char) + len + 10 + ML_EXTRA + 1;
|
|
||||||
+ mfp = xmalloc(mfp_size);
|
|
||||||
|
|
||||||
p = (char_u *)mfp;
|
|
||||||
STRCPY(p, tagp.tagname);
|
|
||||||
p[len] = '@';
|
|
||||||
STRCPY(p + len + 1, help_lang);
|
|
||||||
- snprintf((char *)p + len + 1 + ML_EXTRA, STRLEN(p) + len + 1 + ML_EXTRA, "%06d",
|
|
||||||
+ snprintf((char *)p + len + 1 + ML_EXTRA, mfp_size - (len + 1 + ML_EXTRA), "%06d",
|
|
||||||
help_heuristic(tagp.tagname,
|
|
||||||
match_re ? matchoff : 0, !match_no_ic)
|
|
||||||
+ help_pri);
|
|
Loading…
Reference in New Issue
Block a user