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

[Bug-Candidate]: Vyper unpacking call's returned values crash Slither #2378

Open
trocher opened this issue Mar 26, 2024 · 0 comments
Open

[Bug-Candidate]: Vyper unpacking call's returned values crash Slither #2378

trocher opened this issue Mar 26, 2024 · 0 comments
Labels
bug-candidate Bugs reports that are not yet confirmed

Comments

@trocher
Copy link

trocher commented Mar 26, 2024

Describe the issue:

When unpacking the returned values of a call, if multiple values are returned, Slither crashes.

Code example to reproduce the issue:

# @version 0.3.7

interface X:
    def bar() -> (address, address): nonpayable

@internal
def foo(x: X):

    a: address = empty(address)
    b: address = empty(address)
    a, b = x.bar()

Version:

0.10.1

Relevant log output:

Traceback (most recent call last):
  File "/home/csdocker/.local/bin/slither", line 8, in <module>
    sys.exit(main())
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/__main__.py", line 746, in main
    main_impl(all_detector_classes=detectors, all_printer_classes=printers)
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/__main__.py", line 852, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/__main__.py", line 107, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/__main__.py", line 80, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/slither.py", line 150, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/slither.py", line 170, in _init_parsing_and_analyses
    raise e
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/slither.py", line 166, in _init_parsing_and_analyses
    parser.analyze_contracts()
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/vyper_parsing/vyper_compilation_unit.py", line 63, in analyze_contracts
    self._convert_to_slithir()
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/vyper_parsing/vyper_compilation_unit.py", line 73, in _convert_to_slithir
    func.generate_slithir_and_analyze()
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/core/declarations/function.py", line 1772, in generate_slithir_and_analyze
    node.slithir_generation()
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/core/cfg/node.py", line 717, in slithir_generation
    self._irs = convert_expression(expression, self)  # type:ignore
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/slithir/convert.py", line 115, in convert_expression
    visitor = ExpressionToSlithIR(expression, node)
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/visitors/slithir/expression_to_slithir.py", line 174, in __init__
    self._visit_expression(self.expression)
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/visitors/expression/expression.py", line 93, in _visit_expression
    self._post_visit(expression)
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/visitors/expression/expression.py", line 267, in _post_visit
    self._post_assignement_operation(expression)
  File "/home/csdocker/.local/share/pipx/venvs/slither-analyzer/lib/python3.10/site-packages/slither/visitors/slithir/expression_to_slithir.py", line 209, in _post_assignement_operation
    assert isinstance(right, TupleVariable)
AssertionError
@trocher trocher added the bug-candidate Bugs reports that are not yet confirmed label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-candidate Bugs reports that are not yet confirmed
Projects
None yet
Development

No branches or pull requests

1 participant