diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc index b130ed13..5850fb7c 100644 --- a/src/common/dwarf/dwarf2reader.cc +++ b/src/common/dwarf/dwarf2reader.cc @@ -456,8 +456,14 @@ uint64_t CompilationUnit::Start() { void CompilationUnit::ProcessFormStringIndex( uint64_t dieoffset, enum DwarfAttribute attr, enum DwarfForm form, uint64_t str_index) { + const size_t kStringOffsetsTableHeaderSize = + reader_->OffsetSize() == 8 ? 16 : 8; + const uint8_t* str_offsets_table_after_header = str_offsets_base_ ? + str_offsets_buffer_ + str_offsets_base_ : + str_offsets_buffer_ + kStringOffsetsTableHeaderSize; const uint8_t* offset_ptr = - str_offsets_buffer_ + str_offsets_base_ + str_index * reader_->OffsetSize(); + str_offsets_table_after_header + str_index * reader_->OffsetSize(); + const uint64_t offset = reader_->ReadOffset(offset_ptr); if (offset >= string_buffer_length_) { return;