diff -Nru readline-7.0/debian/changelog readline-7.0/debian/changelog --- readline-7.0/debian/changelog 2016-09-17 13:38:00.000000000 +0000 +++ readline-7.0/debian/changelog 2017-05-15 20:00:23.000000000 +0000 @@ -1,14 +1,21 @@ -readline (7.0-0ubuntu2) yakkety; urgency=medium +readline (7.0-3) unstable; urgency=medium - * libreadline-dev: Provide libreadline6-dev. + * Apply upstream patches 002 and 003. Closes: #852750. + + -- Matthias Klose Mon, 15 May 2017 13:00:23 -0700 + +readline (7.0-2) unstable; urgency=medium - -- Matthias Klose Sat, 17 Sep 2016 15:38:00 +0200 + * Apply upstream patch 001. -readline (7.0-0ubuntu1) yakkety; urgency=medium + -- Matthias Klose Tue, 24 Jan 2017 16:17:33 +0100 + +readline (7.0-1) unstable; urgency=medium * Readline 7.0 release. + * libreadline-dev: Provide libreadline6-dev. - -- Matthias Klose Sat, 17 Sep 2016 13:18:51 +0200 + -- Matthias Klose Tue, 04 Oct 2016 00:07:07 +0200 readline (7.0~rc2-1) experimental; urgency=medium diff -Nru readline-7.0/debian/control readline-7.0/debian/control --- readline-7.0/debian/control 2016-09-17 13:37:49.000000000 +0000 +++ readline-7.0/debian/control 2017-01-24 15:19:24.000000000 +0000 @@ -149,6 +149,7 @@ Package: readline-doc Architecture: all +Multi-Arch: foreign Section: doc Depends: dpkg (>= 1.15.4) | install-info, ${misc:Depends} Replaces: libreadline6-dev (<< 6.3-8) diff -Nru readline-7.0/debian/patches/readline70-001.diff readline-7.0/debian/patches/readline70-001.diff --- readline-7.0/debian/patches/readline70-001.diff 1970-01-01 00:00:00.000000000 +0000 +++ readline-7.0/debian/patches/readline70-001.diff 2017-01-24 15:18:22.000000000 +0000 @@ -0,0 +1,50 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-001 + +Bug-Reported-by: Sean Zha +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2016-09/msg00107.html + +Bug-Description: + +Readline-7.0 changed the way the history list is initially allocated to reduce +the number of reallocations and copies. Users who set the readline +history-size variable to a very large number to essentially unlimit the size +of the history list will get memory allocation errors + +Index: b/history.c +=================================================================== +--- a/history.c ++++ b/history.c +@@ -57,6 +57,8 @@ extern int errno; + /* How big to make the_history when we first allocate it. */ + #define DEFAULT_HISTORY_INITIAL_SIZE 502 + ++#define MAX_HISTORY_INITIAL_SIZE 8192 ++ + /* The number of slots to increase the_history by. */ + #define DEFAULT_HISTORY_GROW_SIZE 50 + +@@ -307,7 +309,9 @@ add_history (string) + if (history_size == 0) + { + if (history_stifled && history_max_entries > 0) +- history_size = history_max_entries + 2; ++ history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE) ++ ? MAX_HISTORY_INITIAL_SIZE ++ : history_max_entries + 2; + else + history_size = DEFAULT_HISTORY_INITIAL_SIZE; + the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *)); +Index: b/patchlevel +=================================================================== +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-0 ++1 diff -Nru readline-7.0/debian/patches/readline70-002.diff readline-7.0/debian/patches/readline70-002.diff --- readline-7.0/debian/patches/readline70-002.diff 1970-01-01 00:00:00.000000000 +0000 +++ readline-7.0/debian/patches/readline70-002.diff 2017-05-15 19:59:30.000000000 +0000 @@ -0,0 +1,81 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-002 + +Bug-Reported-by: Hong Cho +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2016-12/msg00002.html + +Bug-Description: + +There is a race condition in add_history() that can be triggered by a fatal +signal arriving between the time the history length is updated and the time +the history list update is completed. A later attempt to reference an +invalid history entry can cause a crash. + +Index: b/history.c +=================================================================== +--- a/history.c ++++ b/history.c +@@ -279,6 +279,7 @@ add_history (string) + const char *string; + { + HIST_ENTRY *temp; ++ int new_length; + + if (history_stifled && (history_length == history_max_entries)) + { +@@ -295,13 +296,9 @@ add_history (string) + + /* Copy the rest of the entries, moving down one slot. Copy includes + trailing NULL. */ +-#if 0 +- for (i = 0; i < history_length; i++) +- the_history[i] = the_history[i + 1]; +-#else + memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *)); +-#endif + ++ new_length = history_length; + history_base++; + } + else +@@ -315,7 +312,7 @@ add_history (string) + else + history_size = DEFAULT_HISTORY_INITIAL_SIZE; + the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *)); +- history_length = 1; ++ new_length = 1; + } + else + { +@@ -325,14 +322,15 @@ add_history (string) + the_history = (HIST_ENTRY **) + xrealloc (the_history, history_size * sizeof (HIST_ENTRY *)); + } +- history_length++; ++ new_length = history_length + 1; + } + } + + temp = alloc_history_entry ((char *)string, hist_inittime ()); + +- the_history[history_length] = (HIST_ENTRY *)NULL; +- the_history[history_length - 1] = temp; ++ the_history[new_length] = (HIST_ENTRY *)NULL; ++ the_history[new_length - 1] = temp; ++ history_length = new_length; + } + + /* Change the time stamp of the most recent history entry to STRING. */ +Index: b/patchlevel +=================================================================== +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-1 ++2 diff -Nru readline-7.0/debian/patches/readline70-003.diff readline-7.0/debian/patches/readline70-003.diff --- readline-7.0/debian/patches/readline70-003.diff 1970-01-01 00:00:00.000000000 +0000 +++ readline-7.0/debian/patches/readline70-003.diff 2017-05-15 19:59:42.000000000 +0000 @@ -0,0 +1,38 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 7.0 +Patch-ID: readline70-003 + +Bug-Reported-by: Frédéric Brière +Bug-Reference-ID: <20170120180724.7ydq7fb2hsp366dj@fabul.fbriere.net> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2017-01/msg00002.html + +Bug-Description: + +Readline-7.0 uses pselect(2) to allow readline to handle signals that do not +interrupt read(2), such as SIGALRM, before reading another character. The +signal mask used in the pselect call did not take into account signals the +calling application blocked before calling readline(). + +Index: b/input.c +=================================================================== +--- a/input.c ++++ b/input.c +@@ -513,6 +513,7 @@ rl_getc (stream) + result = 0; + #if defined (HAVE_PSELECT) + sigemptyset (&empty_set); ++ sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &empty_set); + FD_ZERO (&readfds); + FD_SET (fileno (stream), &readfds); + result = pselect (fileno (stream) + 1, &readfds, NULL, NULL, NULL, &empty_set); +Index: b/patchlevel +=================================================================== +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-2 ++3 diff -Nru readline-7.0/debian/patches/series readline-7.0/debian/patches/series --- readline-7.0/debian/patches/series 2016-08-29 08:00:38.000000000 +0000 +++ readline-7.0/debian/patches/series 2017-05-15 19:58:33.000000000 +0000 @@ -1,4 +1,7 @@ # readline70-001.diff +readline70-001.diff +readline70-002.diff +readline70-003.diff rl-attribute.diff rl-header.diff rl-no-cross-check.diff