summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/DebugInfo
diff options
context:
space:
mode:
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>2018-04-10 01:58:45 +0000
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>2018-04-10 01:58:45 +0000
commit08df84e4f022d09cf58ea9d11ed1ce4b104a64e9 (patch)
tree05d03a5c6d9da12ef08ec855bc9fc61648a5712b /llvm/unittests/DebugInfo
parent76a0154ce5cd60172ded3479bddfdf198b1dddf9 (diff)
downloadbcm5719-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/unittests/DebugInfo')
-rw-r--r--llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp b/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
index 14d358dd152..54da2b719e9 100644
--- a/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
+++ b/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
@@ -593,3 +593,11 @@ TEST_F(TypeIndexIteratorTest, Precomp) {
writeTypeRecords(P, EP);
checkTypeReferences(0);
}
+
+// This is a test for getEncodedIntegerLength()
+TEST_F(TypeIndexIteratorTest, VariableSizeIntegers) {
+ BaseClassRecord BaseClass1(MemberAccess::Public, TypeIndex(47), (uint64_t)-1);
+ BaseClassRecord BaseClass2(MemberAccess::Public, TypeIndex(48), 1);
+ writeFieldList(BaseClass1, BaseClass2);
+ checkTypeReferences(0, TypeIndex(47), TypeIndex(48));
+} \ No newline at end of file
OpenPOWER on IntegriCloud