[Lldb-commits] [lldb] 957a5e9 - [lldb] Fix nullptr dereference in AppleObjCRuntimeV2

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 18 23:30:40 PDT 2021


Author: Jonas Devlieghere
Date: 2021-10-18T23:30:31-07:00
New Revision: 957a5e987444d3193575d6ad8afe6c75da00d794

URL: https://github.com/llvm/llvm-project/commit/957a5e987444d3193575d6ad8afe6c75da00d794
DIFF: https://github.com/llvm/llvm-project/commit/957a5e987444d3193575d6ad8afe6c75da00d794.diff

LOG: [lldb] Fix nullptr dereference in AppleObjCRuntimeV2

Fix a potential nullptr dereference in AppleObjCRuntimeV2 by checking
the result of GetClassInfoUtilityFunction and returning a failure if
it's null.

The DynamicClassInfoExtractor was already doign the right thing, but the
SharedCacheClassInfoExtractor was missing this check.

Added: 
    

Modified: 
    lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index eaab24c3bf682..091bd3752d072 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -1995,6 +1995,11 @@ AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap() {
   const uint32_t num_classes = 128 * 1024;
 
   UtilityFunction *get_class_info_code = GetClassInfoUtilityFunction(exe_ctx);
+  if (!get_class_info_code) {
+    // The callee will have already logged a useful error message.
+    return DescriptorMapUpdateResult::Fail();
+  }
+
   FunctionCaller *get_shared_cache_class_info_function =
       get_class_info_code->GetFunctionCaller();
 


        


More information about the lldb-commits mailing list