Skip to content

Commit 1bb4e80

Browse files
Merge pull request #10806 from adrian-prantl/safety-limit
[lldb] Add a safety limit for walking parent classes
2 parents 7839c19 + da31a02 commit 1bb4e80

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
if (!ti_or_err) {

0 commit comments

Comments
 (0)