diff options
author | Pavel Labath <labath@google.com> | 2018-03-29 15:12:45 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-03-29 15:12:45 +0000 |
commit | ea0f841c3b4063ec5e8edc2d5976a9f803efec6c (patch) | |
tree | c7d8b5d8f787dcb8b457f03d61d19c35b6dd54a5 /llvm/lib/DebugInfo | |
parent | b2f2bb26e443d21d57cc1b5ebcfdd86b33417e4d (diff) | |
download | bcm5719-llvm-ea0f841c3b4063ec5e8edc2d5976a9f803efec6c.tar.gz bcm5719-llvm-ea0f841c3b4063ec5e8edc2d5976a9f803efec6c.zip |
.debug_names: Correctly align the AugmentationStringSize field
We should align the value of the field, not the overall section offset.
This distinction matters if one of the debug_names contributions is not
of size which is a multiple of four. The dwarf producers may choose to
emit rounded contributions, but they are not required to do so. In the
latter case, without this patch we would corrupt the parsing state, as
we would adjust the offset even if subsequent contributions contained
correctly rounded augmentation strings.
llvm-svn: 328796
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp index 40174119b0a..fccff271e1f 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp @@ -385,7 +385,7 @@ llvm::Error DWARFDebugNames::Header::extract(const DWARFDataExtractor &AS, BucketCount = AS.getU32(Offset); NameCount = AS.getU32(Offset); AbbrevTableSize = AS.getU32(Offset); - AugmentationStringSize = AS.getU32(Offset); + AugmentationStringSize = alignTo(AS.getU32(Offset), 4); if (!AS.isValidOffsetForDataOfSize(*Offset, AugmentationStringSize)) return make_error<StringError>( @@ -394,7 +394,6 @@ llvm::Error DWARFDebugNames::Header::extract(const DWARFDataExtractor &AS, AugmentationString.resize(AugmentationStringSize); AS.getU8(Offset, reinterpret_cast<uint8_t *>(AugmentationString.data()), AugmentationStringSize); - *Offset = alignTo(*Offset, 4); return Error::success(); } |