[Lldb-commits] [lldb] r361444 - [lldb] Fix use-of-uninitialized-value in Driver

Jorge Gorbe Moya via lldb-commits lldb-commits at lists.llvm.org
Wed May 22 16:37:48 PDT 2019


Author: jgorbe
Date: Wed May 22 16:37:48 2019
New Revision: 361444

URL: http://llvm.org/viewvc/llvm-project?rev=361444&view=rev
Log:
[lldb] Fix use-of-uninitialized-value in Driver

The driver passes by reference an uninitialized num_errors variable to
RunCommandInterpreter. This should be fine, as it's supposed to be
an output argument, but the reproducer instrumentation reads it in order
to record the value of all the arguments to the function.

This change fixes it by initializing num_errors to 0 before calling
RunCommandInterpreter.

Modified:
    lldb/trunk/tools/driver/Driver.cpp

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=361444&r1=361443&r2=361444&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Wed May 22 16:37:48 2019
@@ -610,7 +610,7 @@ int Driver::MainLoop() {
       // that run the target won't run in a sensible way.
       bool old_async = m_debugger.GetAsync();
       m_debugger.SetAsync(false);
-      int num_errors;
+      int num_errors = 0;
 
       SBCommandInterpreterRunOptions options;
       options.SetStopOnError(true);




More information about the lldb-commits mailing list