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

Slither crashes when parsing access to anonymous array #139

Closed
Xenomega opened this issue Jan 15, 2019 · 1 comment
Closed

Slither crashes when parsing access to anonymous array #139

Xenomega opened this issue Jan 15, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@Xenomega
Copy link
Member

The following contract will crash slither:

contract C {
    function f(uint x) public returns (uint){
         return [0, 1][x];
    }
}

Stack trace:

ERROR:root:Traceback (most recent call last):
  File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 250, in main_impl
    (results, number_contracts) = process(filename, args, detector_classes, printer_classes)
  File "c:\users\vyper\documents\github\slither\slither\__main__.py", line 35, in process
    slither = Slither(filename, args.solc, args.disable_solc_warnings, args.solc_args, ast)
  File "c:\users\vyper\documents\github\slither\slither\slither.py", line 41, in __init__
    self._analyze_contracts()
  File "c:\users\vyper\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 214, in _analyze_contracts
    self._convert_to_slithir()
  File "c:\users\vyper\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 341, in _convert_to_slithir
    contract.convert_expression_to_slithir()
  File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\contract.py", line 367, in convert_expression_to_slithir
    func.generate_slithir_and_analyze()
  File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\function.py", line 927, in generate_slithir_and_analyze
    node.slithir_generation()
  File "c:\users\vyper\documents\github\slither\slither\core\cfg\node.py", line 506, in slithir_generation
    self._irs = convert_expression(expression, self)
  File "c:\users\vyper\documents\github\slither\slither\slithir\convert.py", line 734, in convert_expression
    visitor = ExpressionToSlithIR(expression, node)
  File "c:\users\vyper\documents\github\slither\slither\visitors\slithir\expression_to_slithir.py", line 70, in __init__
    self._visit_expression(self.expression)
  File "c:\users\vyper\documents\github\slither\slither\visitors\expression\expression.py", line 92, in _visit_expression
    self._post_visit(expression)
  File "c:\users\vyper\documents\github\slither\slither\visitors\expression\expression.py", line 275, in _post_visit
    self._post_index_access(expression)
  File "c:\users\vyper\documents\github\slither\slither\visitors\slithir\expression_to_slithir.py", line 163, in _post_index_access
    operation = Index(val, left, right, expression.type)
  File "c:\users\vyper\documents\github\slither\slither\slithir\operations\index.py", line 13, in __init__
    assert is_valid_lvalue(left_variable) or left_variable == SolidityVariableComposed('msg.data')
AssertionError
@montyly montyly added the bug Something isn't working label Jan 17, 2019
@montyly
Copy link
Member

montyly commented Jan 18, 2019

Fixed in dev

@montyly montyly closed this as completed Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants