diff --git a/src/tests/demo/main.cpp b/src/tests/demo/main.cpp index 43c47ab..66f13a8 100644 --- a/src/tests/demo/main.cpp +++ b/src/tests/demo/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char* argv[]) { return result; }; - theo::theo_t t(fdata, {allocator, copier, resolver}, "EntryPoint"); + theo::theo_t t(fdata, {allocator, copier, resolver}, "main"); auto res = t.decompose(); if (!res.has_value()) { diff --git a/src/theo/decomp/decomp.cpp b/src/theo/decomp/decomp.cpp index 5bb401c..2f1a479 100644 --- a/src/theo/decomp/decomp.cpp +++ b/src/theo/decomp/decomp.cpp @@ -25,8 +25,11 @@ std::optional decomp_t::decompose( std::for_each( m_objs.begin(), m_objs.end(), [&](std::vector& img_data) { auto img = reinterpret_cast(img_data.data()); - for (auto idx = 0u; idx < img->file_header.num_symbols - 1; ++idx) { + for (auto idx = 0u; idx < img->file_header.num_symbols; ++idx) { auto sym = img->get_symbol(idx); + if (sym->section_index - 1 > img->file_header.num_sections) + continue; + auto sym_name = symbol_t::name(img, sym); if (sym_name.length()) { auto sym_hash = symbol_t::hash(sym_name.data());