[Lldb-commits] [lldb] r348813 - Fix undefined behavior in Variable.h
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 10 16:15:03 PST 2018
Author: zturner
Date: Mon Dec 10 16:15:03 2018
New Revision: 348813
URL: http://llvm.org/viewvc/llvm-project?rev=348813&view=rev
Log:
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.
Modified:
lldb/trunk/source/Symbol/Variable.cpp
Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=348813&r1=348812&r2=348813&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Mon Dec 10 16:15:03 2018
@@ -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
More information about the lldb-commits
mailing list