diff options
author | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2018-04-10 01:58:45 +0000 |
---|---|---|
committer | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2018-04-10 01:58:45 +0000 |
commit | 08df84e4f022d09cf58ea9d11ed1ce4b104a64e9 (patch) | |
tree | 05d03a5c6d9da12ef08ec855bc9fc61648a5712b /llvm/lib/DebugInfo/CodeView | |
parent | 76a0154ce5cd60172ded3479bddfdf198b1dddf9 (diff) | |
download | bcm5719-llvm-08df84e4f022d09cf58ea9d11ed1ce4b104a64e9.tar.gz bcm5719-llvm-08df84e4f022d09cf58ea9d11ed1ce4b104a64e9.zip |
[DebugInfo][COFF] Fix reading variable-length encoded records
While reading Codeview records which contain variable-length encoded integers,
such as LF_BCLASS, LF_ENUMERATE, LF_MEMBER, LF_VBCLASS or LF_IVBCLASS,
the record's size would be improperly calculated in cases where the value was
indeed of a variable length (>= LF_NUMERIC). This caused a bad alignement on
the next record, which would/might crash later on.
Differential Revision: https://reviews.llvm.org/D45104
llvm-svn: 329659
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView')
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp b/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp index d283e9e6d2f..95082d4a8e0 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp @@ -58,7 +58,7 @@ static inline uint32_t getEncodedIntegerLength(ArrayRef<uint8_t> Data) { 8, // LF_UQUADWORD }; - return Sizes[N - LF_NUMERIC]; + return 2 + Sizes[N - LF_NUMERIC]; } static inline uint32_t getCStringLength(ArrayRef<uint8_t> Data) { @@ -393,7 +393,7 @@ static bool discoverTypeIndices(ArrayRef<uint8_t> Content, SymbolKind Kind, Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type break; case SymbolKind::S_REGISTER: - Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type; + Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type break; case SymbolKind::S_CONSTANT: Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type |