From 24d26714e025c0610ad7f9014c47d9874a11b069 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 29 Apr 2019 13:54:12 +0000 Subject: [PATCH] Editline: Fix an msan error Summary: libedit implementation of el_get(EL_GETTC) had a bug, where it was consuming vararg arguments until reaching the first null pointer (and not just two, as documented). This was causing (at least) errors to be reported when running the tests under msan. The issue has since been fixed in libedit, but this adds patch adds a trivial workaround, so that we operate correctly with the libedit versions which are already out there. Reviewers: christos, krytarowski, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D61191 llvm-svn: 359449 --- lldb/source/Host/common/Editline.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index c9cc5c0..da83de6 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -1215,9 +1215,13 @@ void Editline::TerminalSizeChanged() { if (m_editline != nullptr) { el_resize(m_editline); int columns; - // Despite the man page claiming non-zero indicates success, it's actually - // zero - if (el_get(m_editline, EL_GETTC, "co", &columns) == 0) { + // This function is documenting as taking (const char *, void *) for the + // vararg part, but in reality in was consuming arguments until the first + // null pointer. This was fixed in libedit in April 2019 + // , + // but we're keeping the workaround until a version with that fix is more + // widely available. + if (el_get(m_editline, EL_GETTC, "co", &columns, nullptr) == 0) { m_terminal_width = columns; if (m_current_line_rows != -1) { const LineInfoW *info = el_wline(m_editline); -- 2.7.4