llvm.org GIT mirror llvm / d5468bf
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 Adrian Prantl 6 years ago
1 changed file(s) with 3 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
3535
3636 void DWARFDebugLoc::parse(DataExtractor data, unsigned AddressSize) {
3737 uint32_t Offset = 0;
38 while (data.isValidOffset(Offset)) {
38 while (data.isValidOffset(Offset+AddressSize-1)) {
3939 Locations.resize(Locations.size() + 1);
4040 LocationList &Loc = Locations.back();
4141 Loc.Offset = Offset;
7070 Loc.Entries.push_back(llvm_move(E));
7171 }
7272 }
73 if (data.isValidOffset(Offset))
74 llvm::errs() << "error: failed to consume entire .debug_loc section\n";
7375 }