mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-12 02:47:10 +00:00
make llvm-dwarfdump a little more resilient when parsing .debug_loc
sections. The call to data.getUnsigned(&Offset, AddressSize) only increments Offset if the read succeeds, which will result in an infinite loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201179 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
69bc4ddf10
commit
d5468bf381
@ -36,7 +36,7 @@ void DWARFDebugLoc::dump(raw_ostream &OS) const {
|
|||||||
|
|
||||||
void DWARFDebugLoc::parse(DataExtractor data, unsigned AddressSize) {
|
void DWARFDebugLoc::parse(DataExtractor data, unsigned AddressSize) {
|
||||||
uint32_t Offset = 0;
|
uint32_t Offset = 0;
|
||||||
while (data.isValidOffset(Offset)) {
|
while (data.isValidOffset(Offset+AddressSize-1)) {
|
||||||
Locations.resize(Locations.size() + 1);
|
Locations.resize(Locations.size() + 1);
|
||||||
LocationList &Loc = Locations.back();
|
LocationList &Loc = Locations.back();
|
||||||
Loc.Offset = Offset;
|
Loc.Offset = Offset;
|
||||||
@ -71,4 +71,6 @@ void DWARFDebugLoc::parse(DataExtractor data, unsigned AddressSize) {
|
|||||||
Loc.Entries.push_back(llvm_move(E));
|
Loc.Entries.push_back(llvm_move(E));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (data.isValidOffset(Offset))
|
||||||
|
llvm::errs() << "error: failed to consume entire .debug_loc section\n";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user