mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 10:01:42 +00:00
Fix undefined behavior in DWARFASTParser::ParseChildArrayInfo()
PR40827: https://bugs.llvm.org/show_bug.cgi?id=40827 <rdar://problem/48729057> llvm-svn: 358137
This commit is contained in:
parent
de051dfe02
commit
3cc634d093
@ -132,10 +132,10 @@ public:
|
|||||||
|
|
||||||
/// The characteristics of an array type.
|
/// The characteristics of an array type.
|
||||||
struct ArrayInfo {
|
struct ArrayInfo {
|
||||||
int64_t first_index;
|
int64_t first_index = 0;
|
||||||
llvm::SmallVector<uint64_t, 1> element_orders;
|
llvm::SmallVector<uint64_t, 1> element_orders;
|
||||||
uint32_t byte_stride;
|
uint32_t byte_stride = 0;
|
||||||
uint32_t bit_stride;
|
uint32_t bit_stride = 0;
|
||||||
};
|
};
|
||||||
/// If \c type_uid points to an array type, return its characteristics.
|
/// If \c type_uid points to an array type, return its characteristics.
|
||||||
/// To support variable-length array types, this function takes an
|
/// To support variable-length array types, this function takes an
|
||||||
|
@ -175,6 +175,8 @@ class ArrayTypesTestCase(TestBase):
|
|||||||
self.DebugSBValue(variable)
|
self.DebugSBValue(variable)
|
||||||
self.assertTrue(variable.GetNumChildren() == 4,
|
self.assertTrue(variable.GetNumChildren() == 4,
|
||||||
"Variable 'strings' should have 4 children")
|
"Variable 'strings' should have 4 children")
|
||||||
|
byte_size = variable.GetByteSize()
|
||||||
|
self.assertTrue(byte_size >= 4*4 and byte_size <= 1024)
|
||||||
|
|
||||||
child3 = variable.GetChildAtIndex(3)
|
child3 = variable.GetChildAtIndex(3)
|
||||||
self.DebugSBValue(child3)
|
self.DebugSBValue(child3)
|
||||||
|
Loading…
Reference in New Issue
Block a user