Skip to content

[6.0] Fix an infinite recursion in NameMatcher if a position to resolve is in the leading whitespace before a token #2709

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

Merged

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jun 27, 2024

  • Explanation: If the name matcher was requested at a location inside whitespace in front of a token, it would try to parse the source file from there in order to match eg. a compound decl name inside the comment. However, if the location was inside leading whitespace, it would just find the token itself again and infinitely recurse.
    Limit the re-parsing to only the trivia text, which fixes the infinite recursion
  • Scope: Name matcher
  • Risk: Low
  • Testing: Added test case
  • Issue: rdar://129922267
  • Reviewer: @bnbarham on Fix an infinite recursion in NameMatcher if a position to resolve is in the leading whitespace before a token #2708

…s in the leading whitespace before a token

rdar://129922267
@ahoppen ahoppen requested a review from bnbarham as a code owner June 27, 2024 19:36
@ahoppen ahoppen changed the title Fix an infinite recursion in NameMatcher if a position to resolve is in the leading whitespace before a token [6.0] Fix an infinite recursion in NameMatcher if a position to resolve is in the leading whitespace before a token Jun 27, 2024
@ahoppen
Copy link
Member Author

ahoppen commented Jun 28, 2024

@swift-ci Please test

@ahoppen ahoppen merged commit f7b2cf4 into swiftlang:release/6.0 Jun 28, 2024
3 checks passed
@ahoppen ahoppen deleted the 6.0/fix-infinite-recursion-namematcher branch June 28, 2024 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants