Bash-5.3 patch 18: fix readline crash with a prompt that exceeds 256 wrapped lines; fix readline redisplay code to print the entire prompt if the first few characters are identical but part of a terminal escape sequence and the prompt needs to be redrawn.

This commit is contained in:
Chet Ramey
2026-09-15 11:15:57 -04:00
parent ee9a3cee01
commit 49502f0cdd
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -1024,6 +1024,7 @@ rl_redisplay (void)
while (local_prompt_newlines[newlines+1] != -1)
{
temp = local_prompt_newlines[newlines+1];
CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = temp;
}
@@ -2261,11 +2262,12 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l
od = ofd - old; /* index of first difference in visible line */
nd = nfd - new; /* nd, od are buffer indexes */
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
_rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
_rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos >= 0 &&
(((od > 0 || nd > 0) && (od <= prompt_last_invisible || nd <= prompt_last_invisible)) ||
((od >= lendiff) && _rl_last_c_pos < PROMPT_ENDING_INDEX)))
{
_rl_cr ();
if (_rl_last_c_pos > 0)
_rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
_rl_output_some_chars (local_prompt, lendiff);
+1 -1
View File
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
#define PATCHLEVEL 17
#define PATCHLEVEL 18
#endif /* _PATCHLEVEL_H_ */