Skip to content

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

Merged
charles-cooper merged 11 commits intovyperlang:masterfrom
cyberthirst:fix/cyclic-check
Aug 7, 2024
Merged

fix[lang]: fix panic in call cycle detection#4200
charles-cooper merged 11 commits intovyperlang:masterfrom
cyberthirst:fix/cyclic-check

Conversation

@cyberthirst
Copy link
Copy Markdown
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

@codecov
Copy link
Copy Markdown

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
Copy Markdown
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
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