llvm.org GIT mirror llvm / c2e7b3e
dwarfdump: Add some error handling for DWP index sections of the wrong size git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252843 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 4 years ago
1 changed file(s) with 7 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1515
1616 bool DWARFUnitIndex::Header::parse(DataExtractor IndexData,
1717 uint32_t *OffsetPtr) {
18 if (!IndexData.isValidOffsetForDataOfSize(*OffsetPtr, 16))
19 return false;
1820 Version = IndexData.getU32(OffsetPtr);
1921 NumColumns = IndexData.getU32(OffsetPtr);
2022 NumUnits = IndexData.getU32(OffsetPtr);
2931 bool DWARFUnitIndex::parse(DataExtractor IndexData) {
3032 uint32_t Offset = 0;
3133 if (!Header.parse(IndexData, &Offset))
34 return false;
35
36 if (!IndexData.isValidOffsetForDataOfSize(
37 Offset, Header.NumBuckets * (8 + 4) +
38 (2 * Header.NumUnits + 1) * 4 * Header.NumColumns))
3239 return false;
3340
3441 Rows = llvm::make_unique(Header.NumBuckets);