[Lldb-commits] [lldb] r219887 - It's possible for long_options[long_options_index].definition to be null

Jason Molenda jmolenda at apple.com
Wed Oct 15 18:26:51 PDT 2014


Author: jmolenda
Date: Wed Oct 15 20:26:51 2014
New Revision: 219887

URL: http://llvm.org/viewvc/llvm-project?rev=219887&view=rev
Log:
It's possible for long_options[long_options_index].definition to be null
from the previous for() loop - check that it is non-null before trying
to deref it.
clang static analyzer fixit.

Modified:
    lldb/trunk/source/Expression/DWARFExpression.cpp
    lldb/trunk/source/Interpreter/Args.cpp

Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=219887&r1=219886&r2=219887&view=diff
==============================================================================
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Wed Oct 15 20:26:51 2014
@@ -2875,7 +2875,7 @@ DWARFExpression::Evaluate
                 if (cfa != LLDB_INVALID_ADDRESS)
                 {
                     stack.push_back(Scalar(cfa));
-                    stack.back().SetValueType (Value::eValueTypeHostAddress);
+                    stack.back().SetValueType (Value::eValueTypeLoadAddress);
                 }
                 else
                     if (error_ptr)

Modified: lldb/trunk/source/Interpreter/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=219887&r1=219886&r2=219887&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Args.cpp (original)
+++ lldb/trunk/source/Interpreter/Args.cpp Wed Oct 15 20:26:51 2014
@@ -685,7 +685,7 @@ Args::ParseOptions (Options &options)
             }
         }
         // Call the callback with the option
-        if (long_options_index >= 0)
+        if (long_options_index >= 0 && long_options[long_options_index].definition)
         {
             const OptionDefinition *def = long_options[long_options_index].definition;
             CommandInterpreter &interpreter = options.GetInterpreter();





More information about the lldb-commits mailing list