diff --git a/0002-nano-3.0-crash-on-bad-quoting-regex.patch b/0002-nano-3.0-crash-on-bad-quoting-regex.patch new file mode 100644 index 0000000..097c6a6 --- /dev/null +++ b/0002-nano-3.0-crash-on-bad-quoting-regex.patch @@ -0,0 +1,49 @@ +From c3bf9d981768bb1e96d73c9a001a6a77713a6245 Mon Sep 17 00:00:00 2001 +From: David Lawrence Ramsey +Date: Mon, 10 Dec 2018 14:25:15 -0600 +Subject: [PATCH] options: exit on a bad quoting regex, instead of crashing + later + +The paragraph-jumping functions used the regex unverified... + +This fixes https://savannah.gnu.org/bugs/?55169. + +Upstream-commit: 6e3b9ac0587243460c1f8a19d3fcc4402f98808d +Signed-off-by: Kamil Dudka +--- + src/nano.c | 2 ++ + src/text.c | 5 ----- + 2 files changed, 2 insertions(+), 5 deletions(-) + +diff --git a/src/nano.c b/src/nano.c +index 74e1243..1900d3e 100644 +--- a/src/nano.c ++++ b/src/nano.c +@@ -2486,6 +2486,8 @@ int main(int argc, char **argv) + + quoteerr = charalloc(size); + regerror(quoterc, "ereg, quoteerr, size); ++ ++ die(_("Bad quoting regex \"%s\": %s\n"), quotestr, quoteerr); + } + #endif /* ENABLE_JUSTIFY */ + +diff --git a/src/text.c b/src/text.c +index 8919916..6e730b6 100644 +--- a/src/text.c ++++ b/src/text.c +@@ -2131,11 +2131,6 @@ bool find_paragraph(size_t *const quote, size_t *const par) + filestruct *current_save; + /* The line at the beginning of the paragraph we search for. */ + +- if (quoterc != 0) { +- statusline(ALERT, _("Bad quote string %s: %s"), quotestr, quoteerr); +- return FALSE; +- } +- + /* If we're at the end of the last line of the file, it means that + * there aren't any paragraphs left, so get out. */ + if (openfile->current == openfile->filebot && openfile->current_x == +-- +2.20.1 + diff --git a/0003-nano-3.0-history-use-after-free.patch b/0003-nano-3.0-history-use-after-free.patch new file mode 100644 index 0000000..3a8bbb4 --- /dev/null +++ b/0003-nano-3.0-history-use-after-free.patch @@ -0,0 +1,48 @@ +From 8817d48ce9b2fccba83251f10cd7827412c9ef41 Mon Sep 17 00:00:00 2001 +From: Brand Huntsman +Date: Wed, 27 Feb 2019 02:40:18 -0700 +Subject: [PATCH] history: use an unfreed 'position_history' to avoid a + possible crash + +The reload_positions_if_needed() routine can free the existing +'position_history' and allocate a new one. Using the old one, +from before the reload, could lead to a crash. + +This fixes https://savannah.gnu.org/bugs/?55792. +Reported-by: Enrico Mioso + +Bug existed since the reloading of the position-history file was +introduced, a year and a half ago, in commit bfc53f30. + +Signed-off-by: Brand Huntsman + +Upstream-commit: a5ef013e826bfd10d530dabbd961f9044b95b53f +Signed-off-by: Kamil Dudka +--- + src/history.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/history.c b/src/history.c +index 5668038..ca8c60d 100644 +--- a/src/history.c ++++ b/src/history.c +@@ -593,7 +593,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos) + * set line and column to the retrieved values. */ + bool has_old_position(const char *file, ssize_t *line, ssize_t *column) + { +- poshiststruct *posptr = position_history; ++ poshiststruct *posptr; + char *fullpath = get_full_path(file); + + if (fullpath == NULL) +@@ -601,6 +601,7 @@ bool has_old_position(const char *file, ssize_t *line, ssize_t *column) + + reload_positions_if_needed(); + ++ posptr = position_history; + while (posptr != NULL && strcmp(posptr->filename, fullpath) != 0) + posptr = posptr->next; + +-- +2.20.1 + diff --git a/0004-nano-3.0-unindent-partial-line.patch b/0004-nano-3.0-unindent-partial-line.patch new file mode 100644 index 0000000..8f1797c --- /dev/null +++ b/0004-nano-3.0-unindent-partial-line.patch @@ -0,0 +1,38 @@ +From c03f2cc36a2539316437cff4313823c0a0882473 Mon Sep 17 00:00:00 2001 +From: Benno Schulenberg +Date: Fri, 12 Apr 2019 14:00:14 +0200 +Subject: [PATCH] unindent: ensure that a partial line gets displayed properly + afterwards + +When only the trailing chunk of a line is displayed on the top row of +the screen, and the unindenting of this line leads to a reduction in +the number of chunks, then the starting point of the viewport needs +to be re-evaluated. For simplicity, do this always when something is +unindented. + +This fixes https://savannah.gnu.org/bugs/?56102. +Reported-by: Devin Hussey + +Bug existed since around version 2.9.2. + +Upstream-commit: 1c707d4f99cc919070104de09efe1e5a6302b6ce +Signed-off-by: Kamil Dudka +--- + src/text.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/text.c b/src/text.c +index 6e730b6..eb0163e 100644 +--- a/src/text.c ++++ b/src/text.c +@@ -443,6 +443,7 @@ void do_unindent(void) + } + + set_modified(); ++ ensure_firstcolumn_is_aligned(); + refresh_needed = TRUE; + shift_held = TRUE; + } +-- +2.20.1 + diff --git a/0005-nano-4.2-help-crash.patch b/0005-nano-4.2-help-crash.patch new file mode 100644 index 0000000..0b55415 --- /dev/null +++ b/0005-nano-4.2-help-crash.patch @@ -0,0 +1,30 @@ +From 00351963c03818d058bfc355663fe0d7c86b9386 Mon Sep 17 00:00:00 2001 +From: Benno Schulenberg +Date: Thu, 23 May 2019 12:43:31 +0200 +Subject: [PATCH] help: don't check for confinement when opening a temporary + help-text file + +This fixes https://savannah.gnu.org/bugs/?56369. + +Upstream-commit: acd23551c3322f397dc43f97796273a8958f6ef9 +Signed-off-by: Kamil Dudka +--- + src/files.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/files.c b/src/files.c +index 20bbd942..7952bc00 100644 +--- a/src/files.c ++++ b/src/files.c +@@ -420,7 +420,7 @@ bool open_buffer(const char *filename, bool new_buffer) + as_an_at = FALSE; + + #ifdef ENABLE_OPERATINGDIR +- if (outside_of_confinement(filename, FALSE)) { ++ if (!inhelp && outside_of_confinement(filename, FALSE)) { + statusline(ALERT, _("Can't read file from outside of %s"), + operating_dir); + return FALSE; +-- +2.20.1 + diff --git a/nano.spec b/nano.spec index 3222e8f..457e99b 100644 --- a/nano.spec +++ b/nano.spec @@ -1,7 +1,7 @@ Summary: A small text editor Name: nano Version: 2.9.8 -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 @@ -19,6 +19,18 @@ Conflicts: filesystem < 3 Requires(post): /sbin/install-info Requires(preun): /sbin/install-info +# do not crash on a bad quoting regex +Patch2: 0002-nano-3.0-crash-on-bad-quoting-regex.patch + +# fix user-after-free bug on position_history +Patch3: 0003-nano-3.0-history-use-after-free.patch + +# display partial lines properly on unindent +Patch4: 0004-nano-3.0-unindent-partial-line.patch + +# fix possible crash while opening help +Patch5: 0005-nano-4.2-help-crash.patch + %description GNU nano is a small and friendly text editor. @@ -80,6 +92,12 @@ exit 0 %{_datadir}/nano %changelog +* Tue May 28 2019 Kamil Dudka - 2.9.8-2 +- fix possible crash while opening help +- display partial lines properly on unindent +- fix user-after-free bug on position_history +- do not crash on a bad quoting regex + * Mon Jun 04 2018 Kamil Dudka - 2.9.8-1 - new upstream release