Skip to content

Commit da31a02

Browse files
committed
[lldb] Add a safety limit for walking parent classes
1 parent cf4a54e commit da31a02

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/ReflectionContext.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ class TargetReflectionContext : public ReflectionContextInterface {
246246
swift::reflection::DescriptorFinder *descriptor_finder,
247247
const swift::reflection::TypeRef *tr,
248248
std::function<bool(SuperClassType)> fn) override {
249-
while (tr) {
249+
// Guard against faulty self-referential metadata.
250+
unsigned limit = 256;
251+
while (tr && --limit) {
250252
if (fn({[=]() -> const swift::reflection::RecordTypeInfo * {
251253
auto ti_or_err = GetRecordTypeInfo(*tr, tip, descriptor_finder);
252254
LLDB_LOG_ERRORV(GetLog(LLDBLog::Types), ti_or_err.takeError(),

0 commit comments

Comments
 (0)