From 37c809471b9cdd8eea0cb6cc9a06c703e41acfcc Mon Sep 17 00:00:00 2001 From: LC Date: Sun, 12 Jul 2026 00:16:36 -0400 Subject: [PATCH] ElfContainer: Amend entry iteration in GetDynamicLibs() These were using i in the termination condition, which is for section headers, not entries. --- .../CommonTools/Linux/Utils/ELFContainer.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Tools/CommonTools/Linux/Utils/ELFContainer.cpp b/Source/Tools/CommonTools/Linux/Utils/ELFContainer.cpp index 5019b82e3..264657c4c 100644 --- a/Source/Tools/CommonTools/Linux/Utils/ELFContainer.cpp +++ b/Source/Tools/CommonTools/Linux/Utils/ELFContainer.cpp @@ -611,13 +611,13 @@ void ELFContainer::CalculateSymbols() { void ELFContainer::GetDynamicLibs() { if (Mode == MODE_32BIT) { for (uint32_t i = 0; i < SectionHeaders.size(); ++i) { - const Elf32_Shdr* hdr = SectionHeaders.at(i)._32; + const Elf32_Shdr* hdr = SectionHeaders[i]._32; if (hdr->sh_type == SHT_DYNAMIC) { const Elf32_Shdr* StrHeader = SectionHeaders.at(hdr->sh_link)._32; const char* SHStrings = &RawFile.at(StrHeader->sh_offset); size_t Entries = hdr->sh_size / hdr->sh_entsize; - for (size_t j = 0; i < Entries; ++j) { + for (size_t j = 0; j < Entries; ++j) { const Elf32_Dyn* Dynamic = reinterpret_cast(&RawFile.at(hdr->sh_offset + j * hdr->sh_entsize)); if (Dynamic->d_tag == DT_NULL) { break; @@ -630,13 +630,13 @@ void ELFContainer::GetDynamicLibs() { } } else { for (uint32_t i = 0; i < SectionHeaders.size(); ++i) { - const Elf64_Shdr* hdr = SectionHeaders.at(i)._64; + const Elf64_Shdr* hdr = SectionHeaders[i]._64; if (hdr->sh_type == SHT_DYNAMIC) { const Elf64_Shdr* StrHeader = SectionHeaders.at(hdr->sh_link)._64; const char* SHStrings = &RawFile.at(StrHeader->sh_offset); size_t Entries = hdr->sh_size / hdr->sh_entsize; - for (size_t j = 0; i < Entries; ++j) { + for (size_t j = 0; j < Entries; ++j) { const Elf64_Dyn* Dynamic = reinterpret_cast(&RawFile.at(hdr->sh_offset + j * hdr->sh_entsize)); if (Dynamic->d_tag == DT_NULL) { break; @@ -813,10 +813,10 @@ void ELFContainer::GetInitLocations(uint64_t GuestELFBase, fextl::vectorsh_type == SHT_DYNAMIC) { size_t Entries = hdr->sh_size / hdr->sh_entsize; - for (size_t j = 0; i < Entries; ++j) { + for (size_t j = 0; j < Entries; ++j) { const Elf32_Dyn* Dynamic = reinterpret_cast(&RawFile.at(hdr->sh_offset + j * hdr->sh_entsize)); if (Dynamic->d_tag == DT_NULL) { break; @@ -830,7 +830,7 @@ void ELFContainer::GetInitLocations(uint64_t GuestELFBase, fextl::vectorsh_type == SHT_INIT_ARRAY) { size_t Entries = hdr->sh_size / hdr->sh_entsize; for (size_t j = 0; j < Entries; ++j) { @@ -841,10 +841,10 @@ void ELFContainer::GetInitLocations(uint64_t GuestELFBase, fextl::vectorsh_type == SHT_DYNAMIC) { size_t Entries = hdr->sh_size / hdr->sh_entsize; - for (size_t j = 0; i < Entries; ++j) { + for (size_t j = 0; j < Entries; ++j) { const Elf64_Dyn* Dynamic = reinterpret_cast(&RawFile.at(hdr->sh_offset + j * hdr->sh_entsize)); if (Dynamic->d_tag == DT_NULL) { break; @@ -858,7 +858,7 @@ void ELFContainer::GetInitLocations(uint64_t GuestELFBase, fextl::vectorsh_type == SHT_INIT_ARRAY) { size_t Entries = hdr->sh_size / hdr->sh_entsize; for (size_t j = 0; j < Entries; ++j) {