Merge "Fix vtable boundary check in vndk-vtable-dumper"

This commit is contained in:
Treehugger Robot
2018-07-06 10:31:38 +00:00
committed by Gerrit Code Review

View File

@@ -226,7 +226,7 @@ VTable *ELFSharedObject<ELFT>::identifyVTable(uint64_t RelOffset) {
if (It != mVTables.begin() && It->getStartAddr() != RelOffset) {
It--;
}
if (It->getEndAddr() >= RelOffset) {
if (It->getStartAddr() <= RelOffset && It->getEndAddr() > RelOffset) {
return &(*It);
}
return nullptr;
@@ -341,7 +341,7 @@ uint64_t ELFSharedObject<ELFT>::identifyAddend(uint64_t ROffset) {
for (const SectionRef &Section : mProgBitSectionRefs) {
uint64_t Begin = Section.getAddress();
uint64_t End = Section.getAddress() + Section.getSize();
if (ROffset >= Begin && ROffset <= End) {
if (ROffset >= Begin && ROffset < End) {
return getAddendFromSection(Section, ROffset - Begin);
}
}