Don't count str_offsets_table header size before DWARF 5

The header is not present in earlier versions of split dwarf.

Change-Id: I8fde233268230cea157b2b3276f3cf05190962f2
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3083253
Reviewed-by: Sterling Augustine <saugustine@google.com>
This commit is contained in:
Joshua Peraza 2021-08-09 16:19:46 -07:00
parent 4f5b814790
commit bc7ddae234

View File

@ -457,7 +457,7 @@ void CompilationUnit::ProcessFormStringIndex(
uint64_t dieoffset, enum DwarfAttribute attr, enum DwarfForm form, uint64_t dieoffset, enum DwarfAttribute attr, enum DwarfForm form,
uint64_t str_index) { uint64_t str_index) {
const size_t kStringOffsetsTableHeaderSize = const size_t kStringOffsetsTableHeaderSize =
reader_->OffsetSize() == 8 ? 16 : 8; header_.version >= 5 ? (reader_->OffsetSize() == 8 ? 16 : 8) : 0;
const uint8_t* str_offsets_table_after_header = str_offsets_base_ ? const uint8_t* str_offsets_table_after_header = str_offsets_base_ ?
str_offsets_buffer_ + str_offsets_base_ : str_offsets_buffer_ + str_offsets_base_ :
str_offsets_buffer_ + kStringOffsetsTableHeaderSize; str_offsets_buffer_ + kStringOffsetsTableHeaderSize;