[llvm] r252843 - dwarfdump: Add some error handling for DWP index sections of the wrong size
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 11 17:41:59 PST 2015
Author: dblaikie
Date: Wed Nov 11 19:41:59 2015
New Revision: 252843
URL: http://llvm.org/viewvc/llvm-project?rev=252843&view=rev
Log:
dwarfdump: Add some error handling for DWP index sections of the wrong size
Modified:
llvm/trunk/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp?rev=252843&r1=252842&r2=252843&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp Wed Nov 11 19:41:59 2015
@@ -16,6 +16,8 @@ namespace llvm {
bool DWARFUnitIndex::Header::parse(DataExtractor IndexData,
uint32_t *OffsetPtr) {
+ if (!IndexData.isValidOffsetForDataOfSize(*OffsetPtr, 16))
+ return false;
Version = IndexData.getU32(OffsetPtr);
NumColumns = IndexData.getU32(OffsetPtr);
NumUnits = IndexData.getU32(OffsetPtr);
@@ -32,6 +34,11 @@ bool DWARFUnitIndex::parse(DataExtractor
if (!Header.parse(IndexData, &Offset))
return false;
+ if (!IndexData.isValidOffsetForDataOfSize(
+ Offset, Header.NumBuckets * (8 + 4) +
+ (2 * Header.NumUnits + 1) * 4 * Header.NumColumns))
+ return false;
+
Rows = llvm::make_unique<HashRow[]>(Header.NumBuckets);
auto Contribs =
llvm::make_unique<HashRow::SectionContribution *[]>(Header.NumUnits);
More information about the llvm-commits
mailing list