From 6b7673569e98b61e42c0964d388bbf02bdce769d Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 25 Apr 2018 15:36:16 +0200 Subject: [PATCH] fix crash when using word completion --- 0001-nano-2.9.5-word-completion-crash.patch | 35 +++++++++++++++++++++ nano.spec | 9 +++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0001-nano-2.9.5-word-completion-crash.patch diff --git a/0001-nano-2.9.5-word-completion-crash.patch b/0001-nano-2.9.5-word-completion-crash.patch new file mode 100644 index 0000000..0d69952 --- /dev/null +++ b/0001-nano-2.9.5-word-completion-crash.patch @@ -0,0 +1,35 @@ +From ce8fd571c139b6f3096c802ce919b9b3ba6ecfa0 Mon Sep 17 00:00:00 2001 +From: Benno Schulenberg +Date: Mon, 23 Apr 2018 16:37:55 +0200 +Subject: [PATCH] completion: correctly do a signed comparison, to avoid a + segfault + +Bug existed since commit 30fc197b (a month ago) which changed the +type of 'i' from int to size_t, causing the comparison to do the +wrong thing when 'threshold' is negative. + +This fixes https://savannah.gnu.org/bugs/?53722. +Reported-by: Devin Hussey + +Upstream-commit: d53086d38dcf11280ecc628a6d6b88109f1553ab +Signed-off-by: Kamil Dudka +--- + src/text.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/text.c b/src/text.c +index a454a9a..d625456 100644 +--- a/src/text.c ++++ b/src/text.c +@@ -3640,7 +3640,7 @@ void complete_a_word(void) + /* The point where we can stop searching for shard. */ + + /* Traverse the whole line, looking for shard. */ +- for (i = pletion_x; i < threshold; i++) { ++ for (i = pletion_x; (int)i < threshold; i++) { + /* If the first byte doesn't match, run on. */ + if (pletion_line->data[i] != shard[0]) + continue; +-- +2.14.3 + diff --git a/nano.spec b/nano.spec index 493a7b6..b35ff7b 100644 --- a/nano.spec +++ b/nano.spec @@ -1,12 +1,16 @@ Summary: A small text editor Name: nano Version: 2.9.5 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ URL: https://www.nano-editor.org Source: https://www.nano-editor.org/dist/v2.9/%{name}-%{version}.tar.gz Source2: nanorc +# fix crash when using word completion +# https://savannah.gnu.org/bugs/?53722 +Patch1: 0001-nano-2.9.5-word-completion-crash.patch + BuildRequires: file-devel BuildRequires: gettext-devel BuildRequires: gcc @@ -80,6 +84,9 @@ exit 0 %{_datadir}/nano %changelog +* Wed Apr 25 2018 Kamil Dudka - 2.9.5-2 +- fix crash when using word completion + * Thu Mar 29 2018 Kamil Dudka - 2.9.5-1 - new upstream release