Skip to content

Commit 29770a5

Browse files
Merge pull request #9843 from swiftlang/cherrypick-swift/release/6.1-8965dd40c63c
[🍒 swift/release/6.1] [lldb] Handle a byte size of zero in CompilerType::GetValueAsScalar (llvm#123107)
2 parents 94fd311 + 240b183 commit 29770a5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lldb/source/Symbol/CompilerType.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,8 +1119,11 @@ bool CompilerType::GetValueAsScalar(const lldb_private::DataExtractor &data,
11191119
return false;
11201120

11211121
std::optional<uint64_t> byte_size = GetByteSize(exe_scope);
1122-
if (!byte_size)
1122+
// A bit or byte size of 0 is not a bug, but it doesn't make sense to read a
1123+
// scalar of zero size.
1124+
if (!byte_size || *byte_size == 0)
11231125
return false;
1126+
11241127
lldb::offset_t offset = data_byte_offset;
11251128
switch (encoding) {
11261129
case lldb::eEncodingInvalid:

0 commit comments

Comments
 (0)