recipes: libs/readline: downgraded to the version 7.0. Some programs are expecting...
[dragora.git] / patches / readline / readline70-002
blobac76daec77f2318463002c975ed25a0e9a29089f
1                            READLINE PATCH REPORT
2                            =====================
4 Readline-Release: 7.0
5 Patch-ID: readline70-002
7 Bug-Reported-by:        Hong Cho <hong.cho@citrix.com>
8 Bug-Reference-ID:       <c30b5fe62b2543af8297e47ca487c29c@SJCPEX02CL02.citrite.net>
9 Bug-Reference-URL:      http://lists.gnu.org/archive/html/bug-readline/2016-12/msg00002.html
11 Bug-Description:
13 There is a race condition in add_history() that can be triggered by a fatal
14 signal arriving between the time the history length is updated and the time
15 the history list update is completed. A later attempt to reference an
16 invalid history entry can cause a crash.
18 Patch (apply with `patch -p0'):
20 *** ../readline-7.0-patched/history.c   2016-11-11 13:42:49.000000000 -0500
21 --- history.c   2016-12-05 10:37:51.000000000 -0500
22 ***************
23 *** 280,283 ****
24 --- 280,284 ----
25   {
26     HIST_ENTRY *temp;
27 +   int new_length;
28   
29     if (history_stifled && (history_length == history_max_entries))
30 ***************
31 *** 296,306 ****
32         /* Copy the rest of the entries, moving down one slot.  Copy includes
33          trailing NULL.  */
34 - #if 0
35 -       for (i = 0; i < history_length; i++)
36 -       the_history[i] = the_history[i + 1];
37 - #else
38         memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
39 - #endif
40   
41         history_base++;
42       }
43 --- 297,303 ----
44         /* Copy the rest of the entries, moving down one slot.  Copy includes
45          trailing NULL.  */
46         memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
47   
48 +       new_length = history_length;
49         history_base++;
50       }
51 ***************
52 *** 316,320 ****
53             history_size = DEFAULT_HISTORY_INITIAL_SIZE;
54           the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
55 !         history_length = 1;
56         }
57         else
58 --- 313,317 ----
59             history_size = DEFAULT_HISTORY_INITIAL_SIZE;
60           the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
61 !         new_length = 1;
62         }
63         else
64 ***************
65 *** 326,330 ****
66                 xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
67             }
68 !         history_length++;
69         }
70       }
71 --- 323,327 ----
72                 xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
73             }
74 !         new_length = history_length + 1;
75         }
76       }
77 ***************
78 *** 332,337 ****
79     temp = alloc_history_entry ((char *)string, hist_inittime ());
80   
81 !   the_history[history_length] = (HIST_ENTRY *)NULL;
82 !   the_history[history_length - 1] = temp;
83   }
84   
85 --- 329,335 ----
86     temp = alloc_history_entry ((char *)string, hist_inittime ());
87   
88 !   the_history[new_length] = (HIST_ENTRY *)NULL;
89 !   the_history[new_length - 1] = temp;
90 !   history_length = new_length;
91   }
92   
93 *** ../readline-7.0/patchlevel  2013-11-15 08:11:11.000000000 -0500
94 --- patchlevel  2014-03-21 08:28:40.000000000 -0400
95 ***************
96 *** 1,3 ****
97   # Do not edit -- exists only for use by patch
98   
99 ! 1
100 --- 1,3 ----
101   # Do not edit -- exists only for use by patch
102   
103 ! 2