commit 788af4df46147bce18f929ce79f93e619207978f Author: Todd Fiala Date: Fri Feb 14 13:57:27 2014 -0800 Guard against Python readline module NULL dereference. This fixes the following bug in lldb: http://llvm.org/bugs/show_bug.cgi?id=18841 diff --git a/Modules/readline.c b/Modules/readline.c index 0b043ae..1d62d7d 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -1107,7 +1107,13 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) line = history_get(length + libedit_history_start - 1)->line; } else #endif /* __APPLE__ */ - line = history_get(length)->line; + { + HIST_ENTRY *hist_entry = history_get(length); + if (hist_entry) + line = hist_entry->line; + else + line = ""; + } else line = ""; if (strcmp(p, line))