[Lldb-commits] [lldb] d1d4f36 - [lldb] Make sure there's a value for the key before dereferencing.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 8 13:46:16 PDT 2021


Author: Jonas Devlieghere
Date: 2021-09-08T13:46:09-07:00
New Revision: d1d4f365566ce9aae40d1f46cae517e4fe8fe6ee

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

LOG: [lldb] Make sure there's a value for the key before dereferencing.

Make sure there's a value for the shared_cache_base_address key exists
in the dictionary before trying to dereference the value.

rdar://76894476

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 b4b6c8bf74861..a00b421c9f29b 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2188,8 +2188,12 @@ lldb::addr_t AppleObjCRuntimeV2::GetSharedCacheBaseAddress() {
   if (!info_dict)
     return LLDB_INVALID_ADDRESS;
 
-  return info_dict->GetValueForKey("shared_cache_base_address")
-      ->GetIntegerValue(LLDB_INVALID_ADDRESS);
+  StructuredData::ObjectSP value =
+      info_dict->GetValueForKey("shared_cache_base_address");
+  if (!value)
+    return LLDB_INVALID_ADDRESS;
+
+  return value->GetIntegerValue(LLDB_INVALID_ADDRESS);
 }
 
 void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() {


        


More information about the lldb-commits mailing list