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]: TypeError in solc_parsing/declarations/contract.py, line 775, in _handle_comment #1677

Closed
duckki opened this issue Feb 22, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@duckki
Copy link

duckki commented Feb 22, 2023

Describe the issue:

Certain comments cause the solc_parsing to crash.
It appears to happen with Solidity 0.6 and 0.5, but not with 0.7 and 0.8.

Code example to reproduce the issue:

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.0;

/**
 * @dev text
 */
contract Test {
}

Version:

0.9.2

Relevant log output:

% SOLC_VERSION=0.5.17 slither test.sol
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 834, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 98, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 76, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/opt/homebrew/lib/python3.9/site-packages/slither/slither.py", line 112, in __init__
    parser.parse_top_level_from_loaded_json(ast, path)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 222, in parse_top_level_from_loaded_json
    contract_parser = ContractSolc(self, contract, top_level_data)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/solc_parsing/declarations/contract.py", line 69, in __init__
    self._handle_comment(self._data)
  File "/opt/homebrew/lib/python3.9/site-packages/slither/solc_parsing/declarations/contract.py", line 775, in _handle_comment
    candidates = attributes["documentation"]["text"].replace("\n", ",").split(",")
TypeError: string indices must be integers
@duckki duckki added the bug-candidate Bugs reports that are not yet confirmed label Feb 22, 2023
@0xalpharush 0xalpharush added bug Something isn't working and removed bug-candidate Bugs reports that are not yet confirmed labels Feb 22, 2023
@0xalpharush 0xalpharush changed the title [Bug-Candidate]: TypeError in solc_parsing/declarations/contract.py, line 775, in _handle_comment [Bug]: TypeError in solc_parsing/declarations/contract.py, line 775, in _handle_comment Feb 22, 2023
@0xalpharush
Copy link
Contributor

Closed by #1734

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