summaryrefslogtreecommitdiff
path: root/lib/DebugInfo/DWARFDebugLoc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DebugInfo/DWARFDebugLoc.cpp')
-rw-r--r--lib/DebugInfo/DWARFDebugLoc.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/DebugInfo/DWARFDebugLoc.cpp b/lib/DebugInfo/DWARFDebugLoc.cpp
index 3895ffa8d7..36d17919de 100644
--- a/lib/DebugInfo/DWARFDebugLoc.cpp
+++ b/lib/DebugInfo/DWARFDebugLoc.cpp
@@ -36,7 +36,7 @@ void DWARFDebugLoc::dump(raw_ostream &OS) const {
void DWARFDebugLoc::parse(DataExtractor data, unsigned AddressSize) {
uint32_t Offset = 0;
- while (data.isValidOffset(Offset)) {
+ while (data.isValidOffset(Offset+AddressSize-1)) {
Locations.resize(Locations.size() + 1);
LocationList &Loc = Locations.back();
Loc.Offset = Offset;
@@ -71,4 +71,6 @@ void DWARFDebugLoc::parse(DataExtractor data, unsigned AddressSize) {
Loc.Entries.push_back(llvm_move(E));
}
}
+ if (data.isValidOffset(Offset))
+ llvm::errs() << "error: failed to consume entire .debug_loc section\n";
}