Skip to content
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

fix[lang]: fix panic in call cycle detection #4200

Merged
merged 11 commits into from
Aug 7, 2024

Conversation

cyberthirst
Copy link
Collaborator

@cyberthirst cyberthirst commented Aug 2, 2024

What I did

How I did it

  • check if the func called is the func itself

How to verify it

  • added test

Commit Message

fix cycle detection in `_compute_reachable_set()` by adding a check for
subcycles in the current call path

the function was detecting cycles by checking for a cyclic call to the
*root* of the call path

if the cycle was within the call path (excluding the root) it could
fall into infinite recursion

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 46.14%. Comparing base (99304da) to head (4e44664).

Files Patch % Lines
vyper/semantics/analysis/module.py 0.00% 3 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (99304da) and HEAD (4e44664). Click for more details.

HEAD has 139 uploads less than BASE
Flag BASE (99304da) HEAD (4e44664)
140 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4200       +/-   ##
===========================================
- Coverage   91.36%   46.14%   -45.23%     
===========================================
  Files         109      109               
  Lines       15614    15617        +3     
  Branches     3436     3437        +1     
===========================================
- Hits        14266     7206     -7060     
- Misses        919     7856     +6937     
- Partials      429      555      +126     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cyberthirst cyberthirst added this to the v0.4.1 milestone Aug 5, 2024
if g == root:
message = " -> ".join([f.name for f in path])
if g in path:
extended_path = path + [g]
Copy link
Member

Choose a reason for hiding this comment

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

nice, very clean!

@charles-cooper charles-cooper changed the title fix[lang]: fix recursion check fix[lang]: fix panic in call cycle detection Aug 7, 2024
@charles-cooper charles-cooper enabled auto-merge (squash) August 7, 2024 12:43
@charles-cooper charles-cooper merged commit 9b322d6 into vyperlang:master Aug 7, 2024
156 checks passed
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.

panic on some cyclic function call checks
2 participants