[Lldb-commits] [PATCH] D31485: Verify memory address range validity in GDBRemoteCommunicationClient

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 29 17:12:34 PDT 2017


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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31485.93427.patch
Type: text/x-patch
Size: 687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170330/babd8dae/attachment.bin>


More information about the lldb-commits mailing list