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 | 973b5cde7ec3c4882002381ecb02747e8fe5c69b (patch) | |
tree | 84da2f36e42dbb50cd134c97a3f626992d49d2d8 /llvm/lib/DebugInfo | |
parent | f0bbc1c8fd5f87078a05c013dee3df93d14844af (diff) | |
download | bcm5719-llvm-973b5cde7ec3c4882002381ecb02747e8fe5c69b.tar.gz bcm5719-llvm-973b5cde7ec3c4882002381ecb02747e8fe5c69b.zip |
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.
llvm-svn: 139701
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugArangeSet.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARFDebugArangeSet.cpp b/llvm/lib/DebugInfo/DWARFDebugArangeSet.cpp index a3e2e62104c..148b770bd84 100644 --- a/llvm/lib/DebugInfo/DWARFDebugArangeSet.cpp +++ b/llvm/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 |