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

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 30 14:19:40 PDT 2017


clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Simple logic change so we don't check the range validity more than once.



================
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:1506-1510
+      // We got an invalid address range back
+      if (!region_info.GetRange().IsValid()) {
+        error.SetErrorString("Server returned invalid range");
+      }
+
----------------
Logic is fine, but I would work this into the if statement below. Something like:

```
if (region_info.GetRange().IsValid()) {
  if (!saw_permissions) {
    region_info.SetReadable(MemoryRegionInfo::eNo);
    region_info.SetWritable(MemoryRegionInfo::eNo);
    region_info.SetExecutable(MemoryRegionInfo::eNo);
    region_info.SetMapped(MemoryRegionInfo::eNo);
  }
} else {
  // We got an invalid address range back
  error.SetErrorString("Server returned invalid range");
}
```


https://reviews.llvm.org/D31485





More information about the lldb-commits mailing list