diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-14 17:28:13 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-09-14 17:28:13 +0000 |
commit | 1c0b24f91a5a6f3aeca483e753e7fd27357ecb71 (patch) | |
tree | 94d9db7df1d9529cdc374a03f80aa2467dd9fb98 /lib/DebugInfo/DWARFDebugArangeSet.cpp | |
parent | 0b7b6a08567bc9338b84011fdaca9218b313c371 (diff) |
llvm-dwarfdump: Make the "is debug info section" heuristic stricter so it doesn't accidentaly picks up the wrong section.
Also add some validation code to the aranges section parser.
Fixes PR10926.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139701 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo/DWARFDebugArangeSet.cpp')
-rw-r--r-- | lib/DebugInfo/DWARFDebugArangeSet.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/DebugInfo/DWARFDebugArangeSet.cpp b/lib/DebugInfo/DWARFDebugArangeSet.cpp index a3e2e62104..148b770bd8 100644 --- a/lib/DebugInfo/DWARFDebugArangeSet.cpp +++ b/lib/DebugInfo/DWARFDebugArangeSet.cpp @@ -72,6 +72,13 @@ DWARFDebugArangeSet::extract(DataExtractor data, uint32_t *offset_ptr) { Header.AddrSize = data.getU8(offset_ptr); Header.SegSize = data.getU8(offset_ptr); + // Perform basic validation of the header fields. + if (!data.isValidOffsetForDataOfSize(Offset, Header.Length) || + (Header.AddrSize != 4 && Header.AddrSize != 8)) { + clear(); + return false; + } + // 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 |