mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 20:33:10 +00:00
LibELF: Fix ELF::Image::symbol_count() asserting on section-less ELF
If we have no sections, we also have no symbols, so just return 0. Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28683
This commit is contained in:
parent
ab549cf942
commit
780c64e1f0
|
@ -76,6 +76,8 @@ StringView Image::section_index_to_string(unsigned index) const
|
|||
unsigned Image::symbol_count() const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
if (!section_count())
|
||||
return 0;
|
||||
return section(m_symbol_table_section_index).entry_count();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue