Skip to content

Commit

Permalink
Fix undefined behavior in DWARFASTParser::ParseChildArrayInfo()
Browse files Browse the repository at this point in the history
PR40827: https://bugs.llvm.org/show_bug.cgi?id=40827
<rdar://problem/48729057>

llvm-svn: 358137
  • Loading branch information
adrian-prantl committed Apr 10, 2019
1 parent de051df commit 3cc634d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lldb/include/lldb/Symbol/SymbolFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ class SymbolFile : public PluginInterface {

/// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ def test_and_python_api(self):
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)
Expand Down

0 comments on commit 3cc634d

Please sign in to comment.