Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions llvm/utils/lldbDataFormatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ def StringRefSummaryProvider(valobj, internal_dict):
return '""'

data = data_pointer.deref
# StringRef may be uninitialized with length exceeding available memory,
# potentially causing bad_alloc exceptions. Limit the length to max string summary setting.
limit_obj = (
valobj.GetTarget().GetDebugger().GetSetting("target.max-string-summary-length")
)
if limit_obj:
length = min(length, limit_obj.GetUnsignedIntegerValue())
# Get a char[N] type, from the underlying char type.
array_type = data.type.GetArrayType(length)
# Cast the char* string data to a char[N] array.
Expand Down