[Lldb-commits] [PATCH] D75925: [lldb] reject `.debug_arange` sections with nonzero segment size
Luke Drummond via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 10 08:39:58 PDT 2020
ldrumm created this revision.
ldrumm added reviewers: clayborg, jasonmolenda.
ldrumm added a project: LLDB.
If a producer emits a nonzero segment size, `lldb` will silently read
incorrect values and crash, or do something worse later, as the tuple
size is expected to be 2, rather than 3.
Neither LLVM, nor GCC produce segmented aranges, but this dangerous case
should still be checked and handled.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75925
Files:
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
@@ -63,7 +63,8 @@
// 1 - the version looks good
// 2 - the address byte size looks plausible
// 3 - the length seems to make sense
- // size looks plausible
+ // 4 - size looks plausible
+ // 5 - the arange tuples do not contain a segment field
if (m_header.version < 2 || m_header.version > 5)
return llvm::make_error<llvm::object::GenericBinaryError>(
"Invalid arange header version");
@@ -81,6 +82,10 @@
return llvm::make_error<llvm::object::GenericBinaryError>(
"Invalid arange header length");
+ if (m_header.seg_size)
+ return llvm::make_error<llvm::object::GenericBinaryError>(
+ "segmented arange entries are not supported");
+
// The first tuple following the header in each set begins at an offset
// that is a multiple of the size of a single tuple (that is, twice the
// size of an address). The header is padded, if necessary, to the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75925.249386.patch
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200310/856b63c9/attachment.bin>
More information about the lldb-commits
mailing list