Account for string offsets table header size
Section 7.26 of the DWARF 5 spec describes a header of either 8 or 16 bytes before the offsets begin. Bug: b/187205051 Change-Id: I1ba01008dcd7a533f59d3865762ca09b9d43032b Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3016609 Reviewed-by: Sterling Augustine <saugustine@google.com>
This commit is contained in:
parent
68735f74e7
commit
415b54ab8c
1 changed files with 7 additions and 1 deletions
|
@ -456,8 +456,14 @@ uint64_t CompilationUnit::Start() {
|
||||||
void CompilationUnit::ProcessFormStringIndex(
|
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 =
|
||||||
|
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 =
|
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);
|
const uint64_t offset = reader_->ReadOffset(offset_ptr);
|
||||||
if (offset >= string_buffer_length_) {
|
if (offset >= string_buffer_length_) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue