From 9d76e42014f1b73fbfb5c80b106332e1351ca703 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 11 Dec 2018 00:15:03 +0000 Subject: [PATCH] Fix undefined behavior in Variable.h m_loc_is_constant_data was uninitialized, so unless someone explicitly called SetLocIsConstantData(), this would be UB. I think every existing call-site would always call the proper function to initialize the value, so there were no existing bugs, but I encountered this when I tried to use it without calling this function and encountered this. llvm-svn: 348813 --- lldb/source/Symbol/Variable.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp index 2573c87..ffed48a 100644 --- a/lldb/source/Symbol/Variable.cpp +++ b/lldb/source/Symbol/Variable.cpp @@ -50,7 +50,8 @@ Variable::Variable( m_symfile_type_sp(symfile_type_sp), m_scope(scope), m_owner_scope(context), m_scope_range(scope_range), m_declaration(decl_ptr), m_location(location), m_external(external), - m_artificial(artificial), m_static_member(static_member) {} + m_artificial(artificial), m_loc_is_const_data(false), + m_static_member(static_member) {} //---------------------------------------------------------------------- // Destructor -- 2.7.4