bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: realloc: start and end chunk sizes differ - rl_extend_line_buffer in


From: Eduardo A . Bustamante López
Subject: Re: realloc: start and end chunk sizes differ - rl_extend_line_buffer in lib/readline/util.c
Date: Mon, 7 Jan 2019 01:30:46 -0800
User-agent: Mutt/1.10.1 (2018-07-13)

On Sun, Jan 06, 2019 at 08:46:33PM -0800, Eduardo A. Bustamante López wrote:
> On Sun, Jan 06, 2019 at 07:18:27PM -0800, Eduardo A. Bustamante López wrote:
> (...)
> > malloc: unknown:0: assertion botched
> > malloc: 0x555555769408: allocated: last allocated from unknown:0
> > realloc: start and end chunk sizes differ
> 
> OK, I think I know what the problem is.
(...)
> I still don't know how to trigger this with "human" input, but I think the
> problem is that rl_point should be bounded by the value of rl_end, thus the
> following patch makes the problem go away:
> 
> dualbus@system76-pc:~/src/gnu/bash$ git diff -- lib/readline/undo.c
> diff --git a/lib/readline/undo.c b/lib/readline/undo.c
> index ae65d380..12952555 100644
> --- a/lib/readline/undo.c
> +++ b/lib/readline/undo.c
> @@ -196,6 +196,8 @@ rl_do_undo (void)
>         /* Undoing deletes means inserting some text. */
>         case UNDO_DELETE:
>           rl_point = start;
> +         if (rl_point > rl_end)
> +           rl_point = rl_end;
>           rl_insert_text (rl_undo_list->text);
>           xfree (rl_undo_list->text);
>           break;

I missed a spot, updated patch:

diff -ruN bash-5.0-rc1.orig/lib/readline/undo.c bash-5.0-rc1/lib/readline/undo.c
--- bash-5.0-rc1.orig/lib/readline/undo.c       2019-01-03 13:14:43.428392927 
-0800
+++ bash-5.0-rc1/lib/readline/undo.c    2019-01-07 01:28:08.288255650 -0800
@@ -196,6 +196,8 @@
        /* Undoing deletes means inserting some text. */
        case UNDO_DELETE:
          rl_point = start;
+         if (rl_point > rl_end)
+           rl_point = rl_end;
          rl_insert_text (rl_undo_list->text);
          xfree (rl_undo_list->text);
          break;
@@ -204,6 +206,8 @@
        case UNDO_INSERT:
          rl_delete_text (start, end);
          rl_point = start;
+         if (rl_point > rl_end)
+           rl_point = rl_end;
          break;
 
        /* Undoing an END means undoing everything 'til we get to a BEGIN. */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]