Skip to content

[lldb] Add a safety limit for walking parent classes #10806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: swift/release/6.2
Choose a base branch
from
Open
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ class TargetReflectionContext : public ReflectionContextInterface {
swift::reflection::DescriptorFinder *descriptor_finder,
const swift::reflection::TypeRef *tr,
std::function<bool(SuperClassType)> fn) override {
while (tr) {
// Guard against faulty self-referential metadata.
unsigned limit = 256;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
unsigned limit = 256;
static constexpr unsigned kLimit = 256;

while (tr && --limit) {
if (fn({[=]() -> const swift::reflection::RecordTypeInfo * {
auto ti_or_err = GetRecordTypeInfo(*tr, tip, descriptor_finder);
LLDB_LOG_ERRORV(GetLog(LLDBLog::Types), ti_or_err.takeError(),
Expand Down