diff --git a/vndk/tools/vtable-dumper/elf_handling.cpp b/vndk/tools/vtable-dumper/elf_handling.cpp index e0483dbdb82..4e09a8837ba 100644 --- a/vndk/tools/vtable-dumper/elf_handling.cpp +++ b/vndk/tools/vtable-dumper/elf_handling.cpp @@ -226,7 +226,7 @@ VTable *ELFSharedObject::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::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); } }