[Lldb-commits] [lldb] r359449 - Editline: Fix an msan error

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 29 06:54:12 PDT 2019


Author: labath
Date: Mon Apr 29 06:54:12 2019
New Revision: 359449

URL: http://llvm.org/viewvc/llvm-project?rev=359449&view=rev
Log:
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

Modified:
    lldb/trunk/source/Host/common/Editline.cpp

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=359449&r1=359448&r2=359449&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Mon Apr 29 06:54:12 2019
@@ -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
+    // <http://mail-index.netbsd.org/source-changes/2019/04/26/msg105454.html>,
+    // 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);




More information about the lldb-commits mailing list