[Lldb-commits] [PATCH] D156977: [lldb][lldb-vscode] Fix nullptr dereference when JSON is not an object

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 3 07:56:31 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGbdeb35bda438: [lldb][lldb-vscode] Fix nullptr dereference when JSON is not an object (authored by DavidSpickett).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156977/new/

https://reviews.llvm.org/D156977

Files:
  lldb/tools/lldb-vscode/VSCode.cpp


Index: lldb/tools/lldb-vscode/VSCode.cpp
===================================================================
--- lldb/tools/lldb-vscode/VSCode.cpp
+++ lldb/tools/lldb-vscode/VSCode.cpp
@@ -523,12 +523,13 @@
     }
     return PacketStatus::JSONMalformed;
   }
-  object = *json_value->getAsObject();
-  if (!json_value->getAsObject()) {
+  llvm::json::Object *object_ptr = json_value->getAsObject();
+  if (!object_ptr) {
     if (log)
       *log << "error: json packet isn't a object" << std::endl;
     return PacketStatus::JSONNotObject;
   }
+  object = *object_ptr;
   return PacketStatus::Success;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156977.546876.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230803/f47cf2a3/attachment.bin>


More information about the lldb-commits mailing list