MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / ReadStringTable

Method ReadStringTable

view/elf/elfview.cpp:2639–2662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2637
2638
2639string ElfView::ReadStringTable(BinaryReader& reader, const Elf64SectionHeader& section, uint64_t offset)
2640{
2641 if (offset == 0 || offset > section.size)
2642 return "";
2643
2644 auto itr = m_stringTableCache.find(section.offset);
2645 if (itr == m_stringTableCache.end())
2646 {
2647 if (section.size > GetParentView()->GetLength())
2648 {
2649 m_logger->LogError("Unable to read string table with section offset: 0x%" PRIx64 " size: 0x%" PRIx64, section.offset, section.size);
2650 return "";
2651 }
2652
2653 std::vector<char>& tableCache = m_stringTableCache[section.offset];
2654 tableCache.resize(section.size);
2655 reader.Seek(section.offset);
2656 reader.Read(tableCache.data(), section.size);
2657 itr = m_stringTableCache.find(section.offset);
2658 }
2659
2660 const std::vector<char>& tableCache = itr->second;
2661 return std::string(&tableCache[offset], strlen(tableCache.data() + offset));
2662}
2663
2664
2665// http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-DES

Callers

nothing calls this directly

Calls 8

findMethod · 0.80
LogErrorMethod · 0.80
resizeMethod · 0.80
endMethod · 0.45
GetLengthMethod · 0.45
SeekMethod · 0.45
ReadMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected