[Lldb-commits] [PATCH] D22211: Change the /proc/<pid>/maps to not assert on incorrect input
Tamas Berghammer via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 11 04:24:38 PDT 2016
tberghammer created this revision.
tberghammer added a reviewer: labath.
tberghammer added a subscriber: lldb-commits.
Change the /proc/<pid>/maps to not assert on incorrect input
If LLDB reads some incorrect input form /proc/<pid>/maps then it
should report an error instead of assert-ing as we don't want to
crash in case of an incorrect maps file.
http://reviews.llvm.org/D22211
Files:
source/Plugins/Process/Linux/NativeProcessLinux.cpp
Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===================================================================
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -1907,31 +1907,28 @@
const char read_perm_char = line_extractor.GetChar ();
if (read_perm_char == 'r')
memory_region_info.SetReadable (MemoryRegionInfo::OptionalBool::eYes);
- else
- {
- assert ( (read_perm_char == '-') && "unexpected /proc/{pid}/maps read permission char" );
+ else if (read_perm_char == '-')
memory_region_info.SetReadable (MemoryRegionInfo::OptionalBool::eNo);
- }
+ else
+ return Error ("unexpected /proc/{pid}/maps read permission char");
// Handle write permission.
const char write_perm_char = line_extractor.GetChar ();
if (write_perm_char == 'w')
memory_region_info.SetWritable (MemoryRegionInfo::OptionalBool::eYes);
- else
- {
- assert ( (write_perm_char == '-') && "unexpected /proc/{pid}/maps write permission char" );
+ else if (read_perm_char == '-')
memory_region_info.SetWritable (MemoryRegionInfo::OptionalBool::eNo);
- }
+ else
+ return Error ("unexpected /proc/{pid}/maps write permission char");
// Handle execute permission.
const char exec_perm_char = line_extractor.GetChar ();
if (exec_perm_char == 'x')
memory_region_info.SetExecutable (MemoryRegionInfo::OptionalBool::eYes);
- else
- {
- assert ( (exec_perm_char == '-') && "unexpected /proc/{pid}/maps exec permission char" );
+ else if (read_perm_char == '-')
memory_region_info.SetExecutable (MemoryRegionInfo::OptionalBool::eNo);
- }
+ else
+ return Error ("unexpected /proc/{pid}/maps exec permission char");
return Error ();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22211.63485.patch
Type: text/x-patch
Size: 1862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160711/9379bc14/attachment.bin>
More information about the lldb-commits
mailing list