xiaobai created this revision.

This aims to verify the validity of the response from the debugging
server in GDBRemoteCommunicationClient::GetMemoryRegionInfo. I was
working with ds2 (https://github.com/facebook/ds2) and encountered a bug
that caused the server's response to have a 'size' value of 0, which
caused lldb to behave incorrectly.


https://reviews.llvm.org/D31485

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1503,6 +1503,11 @@
         }
       }
 
+      // We got an invalid address range back
+      if (!region_info.GetRange().IsValid()) {
+        error.SetErrorString("Server returned invalid range");
+      }
+
       // We got a valid address range back but no permissions -- which means
       // this is an unmapped page
       if (region_info.GetRange().IsValid() && saw_permissions == false) {


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1503,6 +1503,11 @@
         }
       }
 
+      // We got an invalid address range back
+      if (!region_info.GetRange().IsValid()) {
+        error.SetErrorString("Server returned invalid range");
+      }
+
       // We got a valid address range back but no permissions -- which means
       // this is an unmapped page
       if (region_info.GetRange().IsValid() && saw_permissions == false) {
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to