[Top][All Lists]

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

[Bug-readline] segfault on a call to rl_callback_read_char()

From: Benoît Ryder
Subject: [Bug-readline] segfault on a call to rl_callback_read_char()
Date: Wed, 4 May 2011 22:29:50 +0200

Hi !

Using version 6.2, when rl_callback_handler_remove() is called from the
callback itself, rl_callback_read_char() may result in a segfault.
It happens when using a single-stroke binding to vi-eof-maybe shadowed by a
two-stroke binding starting by the same stroke.

For instance, using the following inputrc:

  "\C-a": vi-eof-maybe
  "\C-a\C-a": "x"

with the following program:

  #include <stdio.h>
  #include <readline/readline.h>

  static char *line;

  static void callback(char *text)
    line = text;

  int main(void)
    rl_callback_handler_install(">> ", callback);
    line = NULL;
    while( line == NULL ) {
    return 0;

Typing "a" "<C-d>" "b" produces a segfault.

The callback is called twice: first with text "a" then with text "b", but the
callback is reset and it calls the NULL pointer the second time.

Note that it also happens when using other functions instead
'vi-eof-maybe', such as 'yank'.


Benoît Ryder

reply via email to

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