[Lldb-commits] [lldb] r156562 - /lldb/trunk/tools/debugserver/source/RNBServices.cpp

Johnny Chen johnny.chen at apple.com
Thu May 10 12:24:41 PDT 2012


Author: johnny
Date: Thu May 10 14:24:41 2012
New Revision: 156562

URL: http://llvm.org/viewvc/llvm-project?rev=156562&view=rev
Log:
Sanity check the return value from SBSCopyApplicationDisplayIdentifiers() before calling CFArrayGetCount() on it.

rdar://problem/11331867

Modified:
    lldb/trunk/tools/debugserver/source/RNBServices.cpp

Modified: lldb/trunk/tools/debugserver/source/RNBServices.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBServices.cpp?rev=156562&r1=156561&r2=156562&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBServices.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBServices.cpp Thu May 10 14:24:41 2012
@@ -36,7 +36,8 @@
     CFReleaser<CFStringRef> sbsFrontAppID (::SBSCopyFrontmostApplicationDisplayIdentifier ());
     CFReleaser<CFArrayRef> sbsAppIDs (::SBSCopyApplicationDisplayIdentifiers (opt_runningApps, opt_debuggable));
 
-    CFIndex count = ::CFArrayGetCount (sbsAppIDs.get());
+    // Need to check the return value from SBSCopyApplicationDisplayIdentifiers.
+    CFIndex count = sbsAppIDs.get() ? ::CFArrayGetCount (sbsAppIDs.get()) : 0;
     CFIndex i = 0;
     for (i = 0; i < count; i++)
     {





More information about the lldb-commits mailing list