Skip to content

fix: guard against None func in convert_type_of_high_and_internal_level_call (#2375)#2984

Open
aayushbaluni wants to merge 1 commit intocrytic:masterfrom
aayushbaluni:fix/2375-vyper-interface-default-arg-crash
Open

fix: guard against None func in convert_type_of_high_and_internal_level_call (#2375)#2984
aayushbaluni wants to merge 1 commit intocrytic:masterfrom
aayushbaluni:fix/2375-vyper-interface-default-arg-crash

Conversation

@aayushbaluni
Copy link

Summary

Fixes #2375.

Root cause: Vyper interface calls with default arguments (e.g. def price_oracle(i: uint256 = 0)) omit the argument when calling (Pool(a).price_oracle()). The function lookup filters by len(f.parameters) == len(ir.arguments), so the interface function is excluded. func remains None, but the code then accessed func.type, causing AttributeError: 'NoneType' object has no attribute 'type'.

Fix: Add a guard when func is None: set ir.lvalue = None and return early instead of accessing func.type.

Changes

  • slither/slithir/convert.py: Add if func is None check before accessing func.type in convert_type_of_high_and_internal_level_call

Testing

  • Verified the fix addresses the reported scenario: Vyper contract with interface def price_oracle(i: uint256 = 0) and call Pool(a).price_oracle() no longer crashes
  • Change is minimal (3 lines) and follows existing error-handling pattern
  • No unrelated changes included

Made with Cursor

…el_call (crytic#2375)

Root cause: Vyper interface calls with default args (e.g. def f(x=0)) omit
the arg when calling; len(ir.arguments) != len(f.parameters) so lookup fails.
Code then accessed func.type while func was None, causing AttributeError.
@aayushbaluni aayushbaluni requested a review from smonicas as a code owner March 17, 2026 10:10
@CLAassistant
Copy link

CLAassistant commented Mar 17, 2026

CLA assistant check
All committers have signed the CLA.

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.

[Bug]: Vyper interfaces with default argument crash Slither

2 participants