summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-04-29 13:54:12 +0000
committerPavel Labath <pavel@labath.sk>2019-04-29 13:54:12 +0000
commit24d26714e025c0610ad7f9014c47d9874a11b069 (patch)
tree60e2bdd00e0fad5ea09eb169917863fa9204458e
parent50be573ed207baa477e209cf9e8b247ddd402bc5 (diff)
downloadbcm5719-llvm-24d26714e025c0610ad7f9014c47d9874a11b069.tar.gz
bcm5719-llvm-24d26714e025c0610ad7f9014c47d9874a11b069.zip
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
-rw-r--r--lldb/source/Host/common/Editline.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp
index c9cc5c07e40..da83de656df 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
+ // <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);
OpenPOWER on IntegriCloud