From 5f8f290505dae6246bd6dd8da5e9bf9e77d8ad89 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 21 Jun 2017 17:33:30 +0100 Subject: [PATCH 1/2] readline_buffer: add a couple const --- contrib/epee/include/readline_buffer.h | 4 ++-- contrib/epee/src/readline_buffer.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/epee/include/readline_buffer.h b/contrib/epee/include/readline_buffer.h index 7d929bc4..916d14f0 100644 --- a/contrib/epee/include/readline_buffer.h +++ b/contrib/epee/include/readline_buffer.h @@ -13,11 +13,11 @@ namespace rdln void start(); void stop(); int process(); - bool is_running() + bool is_running() const { return m_cout_buf != NULL; } - void get_line(std::string& line); + void get_line(std::string& line) const; void set_prompt(const std::string& prompt); protected: diff --git a/contrib/epee/src/readline_buffer.cpp b/contrib/epee/src/readline_buffer.cpp index 68b739db..9195937a 100644 --- a/contrib/epee/src/readline_buffer.cpp +++ b/contrib/epee/src/readline_buffer.cpp @@ -62,7 +62,7 @@ void rdln::readline_buffer::stop() remove_line_handler(); } -void rdln::readline_buffer::get_line(std::string& line) +void rdln::readline_buffer::get_line(std::string& line) const { std::unique_lock lock(line_mutex); have_line.wait(lock); From 21b939e1e64295e216e2e78d5ff2c6d7a374fa00 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 21 Jun 2017 17:33:47 +0100 Subject: [PATCH 2/2] readline: fix invalid memory access m_cout_buf was not initialized --- contrib/epee/src/readline_buffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/epee/src/readline_buffer.cpp b/contrib/epee/src/readline_buffer.cpp index 9195937a..6305d3e1 100644 --- a/contrib/epee/src/readline_buffer.cpp +++ b/contrib/epee/src/readline_buffer.cpp @@ -39,7 +39,7 @@ rdln::suspend_readline::~suspend_readline() } rdln::readline_buffer::readline_buffer() -: std::stringbuf() +: std::stringbuf(), m_cout_buf(NULL) { current = this; }