fixed a bug where there are symbols with section_index that are

invalid...
3.0
_xeroxz 2 years ago
parent dedfad81a5
commit 71620bcc6e

@ -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()) {

@ -25,8 +25,11 @@ std::optional<recomp::symbol_table_t*> decomp_t::decompose(
std::for_each(
m_objs.begin(), m_objs.end(), [&](std::vector<std::uint8_t>& img_data) {
auto img = reinterpret_cast<coff::image_t*>(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());

Loading…
Cancel
Save