diff options
author | Adrian Prantl <aprantl@apple.com> | 2019-04-10 21:18:44 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2019-04-10 21:18:44 +0000 |
commit | 3cc634d0936ecc1b48e158f687f9f6527bcd8fca (patch) | |
tree | 35035e355576eaaa9c54a54f43eb0cec9311259e | |
parent | de051dfe029ba3e6fb0be31bd94ef3d08ebcfdc7 (diff) | |
download | bcm5719-llvm-3cc634d0936ecc1b48e158f687f9f6527bcd8fca.tar.gz bcm5719-llvm-3cc634d0936ecc1b48e158f687f9f6527bcd8fca.zip |
Fix undefined behavior in DWARFASTParser::ParseChildArrayInfo()
PR40827: https://bugs.llvm.org/show_bug.cgi?id=40827
<rdar://problem/48729057>
llvm-svn: 358137
-rw-r--r-- | lldb/include/lldb/Symbol/SymbolFile.h | 6 | ||||
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index 5d607989f44..e2f18d81c3e 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -132,10 +132,10 @@ public: /// The characteristics of an array type. struct ArrayInfo { - int64_t first_index; + int64_t first_index = 0; llvm::SmallVector<uint64_t, 1> element_orders; - uint32_t byte_stride; - uint32_t bit_stride; + uint32_t byte_stride = 0; + uint32_t bit_stride = 0; }; /// If \c type_uid points to an array type, return its characteristics. /// To support variable-length array types, this function takes an diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py b/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py index a47e6c311d4..da3a46ac0bc 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py @@ -175,6 +175,8 @@ class ArrayTypesTestCase(TestBase): self.DebugSBValue(variable) self.assertTrue(variable.GetNumChildren() == 4, "Variable 'strings' should have 4 children") + byte_size = variable.GetByteSize() + self.assertTrue(byte_size >= 4*4 and byte_size <= 1024) child3 = variable.GetChildAtIndex(3) self.DebugSBValue(child3) |