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

RecursionError: maximum recursion depth exceeded #1737

Closed
0xalpharush opened this issue Mar 9, 2023 · 4 comments
Closed

RecursionError: maximum recursion depth exceeded #1737

0xalpharush opened this issue Mar 9, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@0xalpharush
Copy link
Contributor

I am seeing this issue even with --ignore-compile in a Foundry repo.

$ slither --version
0.9.2

Originally posted by @0xmichalis in #1146 (comment)

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/slither/__main__.py", line 834, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/__main__.py", line 98, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/__main__.py", line 76, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/opt/homebrew/lib/python3.10/site-packages/slither/slither.py", line 134, in __init__
    self._init_parsing_and_analyses(kwargs.get("skip_analyze", False))
  File "/opt/homebrew/lib/python3.10/site-packages/slither/slither.py", line 144, in _init_parsing_and_analyses
    raise e
  File "/opt/homebrew/lib/python3.10/site-packages/slither/slither.py", line 140, in _init_parsing_and_analyses
    parser.parse_contracts()
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 519, in parse_contracts
    self._analyze_third_part(contracts_to_be_analyzed, libraries)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 629, in _analyze_third_part
    self._analyze_variables_modifiers_functions(contract)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 728, in _analyze_variables_modifiers_functions
    contract.analyze_content_functions()
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/declarations/contract.py", line 416, in analyze_content_functions
    function_parser.analyze_content()
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/declarations/function.py", line 286, in analyze_content
    self._parse_cfg(body)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/declarations/function.py", line 1074, in _parse_cfg
    self._remove_incorrect_edges()
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/declarations/function.py", line 1278, in _remove_incorrect_edges
    self._fix_try(node)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/declarations/function.py", line 1153, in _fix_try
    self._fix_catch(son, end_node)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/declarations/function.py", line 1161, in _fix_catch
    self._fix_catch(son, end_node)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/declarations/function.py", line 1161, in _fix_catch
    self._fix_catch(son, end_node)
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/declarations/function.py", line 1161, in _fix_catch
    self._fix_catch(son, end_node)
  [Previous line repeated 1480 more times]
  File "/opt/homebrew/lib/python3.10/site-packages/slither/solc_parsing/declarations/function.py", line 1156, in _fix_catch
    if not node.sons:
RecursionError: maximum recursion depth exceeded
@0xalpharush 0xalpharush added the bug Something isn't working label Mar 9, 2023
@duckki
Copy link

duckki commented Mar 11, 2023

Minimal Reproducer:

pragma solidity ^0.8.0;

interface ITest {
    function run() external returns (uint);
}

contract Test {

    function break_max_recursion(address addr) private {
        try ITest(addr).run() returns (uint rval) {
            for (uint i; i < rval; i++) {
            }
        } catch {
        }
        return; // need some statement here.
    }

}

@0xalpharush
Copy link
Contributor Author

Thanks for minimizing this @duckki!

@outdoteth
Copy link

Any update on this?

@webthethird
Copy link
Contributor

I'm having the same issue when trying to analyse the Foundation marketplace contracts.

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

4 participants