Merge branch 'dev' into dev-json-additionalfields

pull/226/head
Josselin 6 years ago
commit d962ddeb5b
  1. 51
      README.md
  2. 2
      scripts/tests_generate_expected_json_4.sh
  3. 4
      scripts/tests_generate_expected_json_5.sh
  4. 8
      scripts/travis_install.sh
  5. 1
      scripts/travis_test_4.sh
  6. 2
      scripts/travis_test_5.sh
  7. 57
      slither/__main__.py
  8. 7
      slither/all_exceptions.py
  9. 2
      slither/analyses/write/are_variables_written.py
  10. 121
      slither/core/declarations/contract.py
  11. 3
      slither/core/exceptions.py
  12. 8
      slither/core/expressions/assignment_operation.py
  13. 8
      slither/core/expressions/binary_operation.py
  14. 11
      slither/core/expressions/unary_operation.py
  15. 45
      slither/core/variables/state_variable.py
  16. 2
      slither/detectors/all_detectors.py
  17. 9
      slither/detectors/erc/incorrect_erc20_interface.py
  18. 7
      slither/detectors/erc/incorrect_erc721_interface.py
  19. 43
      slither/detectors/operations/unchecked_low_level_return_values.py
  20. 40
      slither/detectors/operations/unchecked_send_return_value.py
  21. 25
      slither/detectors/operations/unused_return_values.py
  22. 3
      slither/exceptions.py
  23. 83
      slither/printers/summary/human_summary.py
  24. 31
      slither/slither.py
  25. 13
      slither/slithir/convert.py
  26. 3
      slither/slithir/exceptions.py
  27. 7
      slither/slithir/operations/binary.py
  28. 2
      slither/slithir/operations/return_operation.py
  29. 9
      slither/slithir/operations/unary.py
  30. 4
      slither/slithir/utils/ssa.py
  31. 6
      slither/slithir/variables/constant.py
  32. 4
      slither/solc_parsing/declarations/contract.py
  33. 10
      slither/solc_parsing/declarations/function.py
  34. 7
      slither/solc_parsing/exceptions.py
  35. 21
      slither/solc_parsing/expressions/expression_parsing.py
  36. 14
      slither/solc_parsing/slitherSolc.py
  37. 10
      slither/solc_parsing/solidity_types/type_parsing.py
  38. 11
      slither/solc_parsing/variables/variable_declaration.py
  39. 69
      slither/utils/erc.py
  40. 193
      slither/utils/standard_libraries.py
  41. 3
      slither/utils/type.py
  42. 2
      slither/visitors/expression/constants_folding.py
  43. 11
      slither/visitors/expression/expression.py
  44. 6
      slither/visitors/slithir/expression_to_slithir.py
  45. 368
      tests/expected_json/arbitrary_send-0.5.1.arbitrary-send.json
  46. 1
      tests/expected_json/arbitrary_send-0.5.1.arbitrary-send.txt
  47. 368
      tests/expected_json/arbitrary_send.arbitrary-send.json
  48. 1
      tests/expected_json/arbitrary_send.arbitrary-send.txt
  49. 86
      tests/expected_json/backdoor.backdoor.json
  50. 2
      tests/expected_json/backdoor.backdoor.txt
  51. 86
      tests/expected_json/backdoor.suicidal.json
  52. 2
      tests/expected_json/backdoor.suicidal.txt
  53. 226
      tests/expected_json/const_state_variables.constable-states.json
  54. 1
      tests/expected_json/const_state_variables.constable-states.txt
  55. 116
      tests/expected_json/constant-0.5.1.constant-function.json
  56. 1
      tests/expected_json/constant-0.5.1.constant-function.txt
  57. 442
      tests/expected_json/constant.constant-function.json
  58. 1
      tests/expected_json/constant.constant-function.txt
  59. 304
      tests/expected_json/controlled_delegatecall.controlled-delegatecall.json
  60. 1
      tests/expected_json/controlled_delegatecall.controlled-delegatecall.txt
  61. 350
      tests/expected_json/deprecated_calls.deprecated-standards.json
  62. 1
      tests/expected_json/deprecated_calls.deprecated-standards.txt
  63. 296
      tests/expected_json/erc20_indexed.erc20-indexed.json
  64. 1
      tests/expected_json/erc20_indexed.erc20-indexed.txt
  65. 398
      tests/expected_json/external_function.external-function.json
  66. 1
      tests/expected_json/external_function.external-function.txt
  67. 6
      tests/expected_json/external_function_2.external-function.json
  68. 1
      tests/expected_json/external_function_2.external-function.txt
  69. 2434
      tests/expected_json/incorrect_equality.incorrect-equality.json
  70. 1
      tests/expected_json/incorrect_equality.incorrect-equality.txt
  71. 408
      tests/expected_json/incorrect_erc20_interface.erc20-interface.json
  72. 1
      tests/expected_json/incorrect_erc20_interface.erc20-interface.txt
  73. 708
      tests/expected_json/incorrect_erc721_interface.erc721-interface.json
  74. 1
      tests/expected_json/incorrect_erc721_interface.erc721-interface.txt
  75. 166
      tests/expected_json/inline_assembly_contract-0.5.1.assembly.json
  76. 1
      tests/expected_json/inline_assembly_contract-0.5.1.assembly.txt
  77. 166
      tests/expected_json/inline_assembly_contract.assembly.json
  78. 1
      tests/expected_json/inline_assembly_contract.assembly.txt
  79. 386
      tests/expected_json/inline_assembly_library-0.5.1.assembly.json
  80. 1
      tests/expected_json/inline_assembly_library-0.5.1.assembly.txt
  81. 386
      tests/expected_json/inline_assembly_library.assembly.json
  82. 1
      tests/expected_json/inline_assembly_library.assembly.txt
  83. 118
      tests/expected_json/locked_ether-0.5.1.locked-ether.json
  84. 1
      tests/expected_json/locked_ether-0.5.1.locked-ether.txt
  85. 118
      tests/expected_json/locked_ether.locked-ether.json
  86. 1
      tests/expected_json/locked_ether.locked-ether.txt
  87. 116
      tests/expected_json/low_level_calls.low-level-calls.json
  88. 1
      tests/expected_json/low_level_calls.low-level-calls.txt
  89. 136
      tests/expected_json/multiple_calls_in_loop.calls-loop.json
  90. 1
      tests/expected_json/multiple_calls_in_loop.calls-loop.txt
  91. 712
      tests/expected_json/naming_convention.naming-convention.json
  92. 1
      tests/expected_json/naming_convention.naming-convention.txt
  93. 52
      tests/expected_json/old_solc.sol.json.solc-version.json
  94. 2
      tests/expected_json/old_solc.sol.json.solc-version.txt
  95. 90
      tests/expected_json/pragma.0.4.24.pragma.json
  96. 16
      tests/expected_json/pragma.0.4.24.pragma.txt
  97. 484
      tests/expected_json/reentrancy-0.5.1.reentrancy-eth.json
  98. 1
      tests/expected_json/reentrancy-0.5.1.reentrancy-eth.txt
  99. 10
      tests/expected_json/reentrancy-0.5.1.reentrancy.txt
  100. 556
      tests/expected_json/reentrancy.reentrancy-eth.json
  101. Some files were not shown because too many files have changed in this diff Show More

@ -48,30 +48,33 @@ Num | Detector | What it Detects | Impact | Confidence
7 | `controlled-delegatecall` | [Controlled delegatecall destination](https://github.com/crytic/slither/wiki/Detector-Documentation#controlled-delegatecall) | High | Medium 7 | `controlled-delegatecall` | [Controlled delegatecall destination](https://github.com/crytic/slither/wiki/Detector-Documentation#controlled-delegatecall) | High | Medium
8 | `reentrancy-eth` | [Reentrancy vulnerabilities (theft of ethers)](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities) | High | Medium 8 | `reentrancy-eth` | [Reentrancy vulnerabilities (theft of ethers)](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities) | High | Medium
9 | `erc20-interface` | [Incorrect ERC20 interfaces](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-erc20-interface) | Medium | High 9 | `erc20-interface` | [Incorrect ERC20 interfaces](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-erc20-interface) | Medium | High
10 | `incorrect-equality` | [Dangerous strict equalities](https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-strict-equalities) | Medium | High 10 | `erc721-interface` | [Incorrect ERC721 interfaces](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-erc721-interface) | Medium | High
11 | `locked-ether` | [Contracts that lock ether](https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether) | Medium | High 11 | `incorrect-equality` | [Dangerous strict equalities](https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-strict-equalities) | Medium | High
12 | `shadowing-abstract` | [State variables shadowing from abstract contracts](https://github.com/crytic/slither/wiki/Detector-Documentation#state-variable-shadowing-from-abstract-contracts) | Medium | High 12 | `locked-ether` | [Contracts that lock ether](https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether) | Medium | High
13 | `constant-function` | [Constant functions changing the state](https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state) | Medium | Medium 13 | `shadowing-abstract` | [State variables shadowing from abstract contracts](https://github.com/crytic/slither/wiki/Detector-Documentation#state-variable-shadowing-from-abstract-contracts) | Medium | High
14 | `reentrancy-no-eth` | [Reentrancy vulnerabilities (no theft of ethers)](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-1) | Medium | Medium 14 | `constant-function` | [Constant functions changing the state](https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state) | Medium | Medium
15 | `tx-origin` | [Dangerous usage of `tx.origin`](https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-usage-of-txorigin) | Medium | Medium 15 | `reentrancy-no-eth` | [Reentrancy vulnerabilities (no theft of ethers)](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-1) | Medium | Medium
16 | `uninitialized-local` | [Uninitialized local variables](https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-local-variables) | Medium | Medium 16 | `tx-origin` | [Dangerous usage of `tx.origin`](https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-usage-of-txorigin) | Medium | Medium
17 | `unused-return` | [Unused return values](https://github.com/crytic/slither/wiki/Detector-Documentation#unused-return) | Medium | Medium 17 | `unchecked-lowlevel` | [Unchecked low-level calls](https://github.com/crytic/slither/wiki/Detector-Documentation#unchecked-low-level) | Medium | Medium
18 | `shadowing-builtin` | [Built-in symbol shadowing](https://github.com/crytic/slither/wiki/Detector-Documentation#builtin-symbol-shadowing) | Low | High 18 | `unchecked-send` | [Unchecked send](https://github.com/crytic/slither/wiki/Detector-Documentation#unchecked-send) | Medium | Medium
19 | `shadowing-local` | [Local variables shadowing](https://github.com/crytic/slither/wiki/Detector-Documentation#local-variable-shadowing) | Low | High 19 | `uninitialized-local` | [Uninitialized local variables](https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-local-variables) | Medium | Medium
20 | `calls-loop` | [Multiple calls in a loop](https://github.com/crytic/slither/wiki/Detector-Documentation/_edit#calls-inside-a-loop) | Low | Medium 20 | `unused-return` | [Unused return values](https://github.com/crytic/slither/wiki/Detector-Documentation#unused-return) | Medium | Medium
21 | `reentrancy-benign` | [Benign reentrancy vulnerabilities](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-2) | Low | Medium 21 | `shadowing-builtin` | [Built-in symbol shadowing](https://github.com/crytic/slither/wiki/Detector-Documentation#builtin-symbol-shadowing) | Low | High
22 | `timestamp` | [Dangerous usage of `block.timestamp`](https://github.com/crytic/slither/wiki/Detector-Documentation#block-timestamp) | Low | Medium 22 | `shadowing-local` | [Local variables shadowing](https://github.com/crytic/slither/wiki/Detector-Documentation#local-variable-shadowing) | Low | High
23 | `assembly` | [Assembly usage](https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage) | Informational | High 23 | `calls-loop` | [Multiple calls in a loop](https://github.com/crytic/slither/wiki/Detector-Documentation/_edit#calls-inside-a-loop) | Low | Medium
24 | `constable-states` | [State variables that could be declared constant](https://github.com/crytic/slither/wiki/Detector-Documentation#state-variables-that-could-be-declared-constant) | Informational | High 24 | `reentrancy-benign` | [Benign reentrancy vulnerabilities](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-2) | Low | Medium
25 | `deprecated-standards` | [Deprecated Solidity Standards](https://github.com/crytic/slither/wiki/Detector-Documentation#deprecated-standards) | Informational | High 25 | `timestamp` | [Dangerous usage of `block.timestamp`](https://github.com/crytic/slither/wiki/Detector-Documentation#block-timestamp) | Low | Medium
26 | `erc20-indexed` | [Un-indexed ERC20 event parameters](https://github.com/crytic/slither/wiki/Detector-Documentation#unindexed-erc20-event-parameters) | Informational | High 26 | `assembly` | [Assembly usage](https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage) | Informational | High
27 | `external-function` | [Public function that could be declared as external](https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-as-external) | Informational | High 27 | `constable-states` | [State variables that could be declared constant](https://github.com/crytic/slither/wiki/Detector-Documentation#state-variables-that-could-be-declared-constant) | Informational | High
28 | `low-level-calls` | [Low level calls](https://github.com/crytic/slither/wiki/Detector-Documentation#low-level-calls) | Informational | High 28 | `deprecated-standards` | [Deprecated Solidity Standards](https://github.com/crytic/slither/wiki/Detector-Documentation#deprecated-standards) | Informational | High
29 | `naming-convention` | [Conformance to Solidity naming conventions](https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions) | Informational | High 29 | `erc20-indexed` | [Un-indexed ERC20 event parameters](https://github.com/crytic/slither/wiki/Detector-Documentation#unindexed-erc20-event-parameters) | Informational | High
30 | `pragma` | [If different pragma directives are used](https://github.com/crytic/slither/wiki/Detector-Documentation#different-pragma-directives-are-used) | Informational | High 30 | `external-function` | [Public function that could be declared as external](https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-as-external) | Informational | High
31 | `solc-version` | [Incorrect Solidity version (< 0.4.24 or complex pragma)](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-version-of-solidity) | Informational | High 31 | `low-level-calls` | [Low level calls](https://github.com/crytic/slither/wiki/Detector-Documentation#low-level-calls) | Informational | High
32 | `unused-state` | [Unused state variables](https://github.com/crytic/slither/wiki/Detector-Documentation#unused-state-variables) | Informational | High 32 | `naming-convention` | [Conformance to Solidity naming conventions](https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions) | Informational | High
33 | `too-many-digits` | [Conformance to numeric notation best practices](https://github.com/crytic/slither/wiki/Detector-Documentation#too-many-digits) | Informational | Medium 33 | `pragma` | [If different pragma directives are used](https://github.com/crytic/slither/wiki/Detector-Documentation#different-pragma-directives-are-used) | Informational | High
34 | `solc-version` | [Incorrect Solidity version (< 0.4.24 or complex pragma)](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-version-of-solidity) | Informational | High
35 | `unused-state` | [Unused state variables](https://github.com/crytic/slither/wiki/Detector-Documentation#unused-state-variables) | Informational | High
36 | `too-many-digits` | [Conformance to numeric notation best practices](https://github.com/crytic/slither/wiki/Detector-Documentation#too-many-digits) | Informational | Medium
[Contact us](https://www.trailofbits.com/contact/) to get access to additional detectors. [Contact us](https://www.trailofbits.com/contact/) to get access to additional detectors.

@ -17,6 +17,7 @@ generate_expected_json(){
sed "s|$CURRENT_PATH|$TRAVIS_PATH|g" "$output_filename" -i sed "s|$CURRENT_PATH|$TRAVIS_PATH|g" "$output_filename" -i
sed "s|$CURRENT_PATH|$TRAVIS_PATH|g" "$output_filename_txt" -i
} }
@ -54,3 +55,4 @@ generate_expected_json(){
#generate_expected_json tests/shadowing_local_variable.sol "shadowing-local" #generate_expected_json tests/shadowing_local_variable.sol "shadowing-local"
#generate_expected_json tests/solc_version_incorrect.sol "solc-version" #generate_expected_json tests/solc_version_incorrect.sol "solc-version"
#generate_expected_json tests/right_to_left_override.sol "rtlo" #generate_expected_json tests/right_to_left_override.sol "rtlo"
#generate_expected_json tests/unchecked_lowlevel.sol "unchecked-lowlevel"

@ -17,6 +17,7 @@ generate_expected_json(){
slither "$1" --solc-disable-warnings --detect "$2" --json "$output_filename" --solc solc-0.5.1 > $output_filename_txt 2>&1 slither "$1" --solc-disable-warnings --detect "$2" --json "$output_filename" --solc solc-0.5.1 > $output_filename_txt 2>&1
sed "s|$CURRENT_PATH|$TRAVIS_PATH|g" "$output_filename" -i sed "s|$CURRENT_PATH|$TRAVIS_PATH|g" "$output_filename" -i
sed "s|$CURRENT_PATH|$TRAVIS_PATH|g" "$output_filename_txt" -i
} }
#generate_expected_json tests/uninitialized-0.5.1.sol "uninitialized-state" #generate_expected_json tests/uninitialized-0.5.1.sol "uninitialized-state"
@ -25,7 +26,6 @@ generate_expected_json(){
#generate_expected_json tests/pragma.0.4.24.sol "pragma" #generate_expected_json tests/pragma.0.4.24.sol "pragma"
#generate_expected_json tests/old_solc.sol.json "solc-version" #generate_expected_json tests/old_solc.sol.json "solc-version"
#generate_expected_json tests/reentrancy-0.5.1.sol "reentrancy-eth" #generate_expected_json tests/reentrancy-0.5.1.sol "reentrancy-eth"
#generate_expected_json tests/reentrancy-0.5.1.sol "reentrancy"
#generate_expected_json tests/uninitialized_storage_pointer.sol "uninitialized-storage" #generate_expected_json tests/uninitialized_storage_pointer.sol "uninitialized-storage"
#generate_expected_json tests/tx_origin-0.5.1.sol "tx-origin" #generate_expected_json tests/tx_origin-0.5.1.sol "tx-origin"
#generate_expected_json tests/locked_ether-0.5.1.sol "locked-ether" #generate_expected_json tests/locked_ether-0.5.1.sol "locked-ether"
@ -35,4 +35,6 @@ generate_expected_json(){
#generate_expected_json tests/constant-0.5.1.sol "constant-function" #generate_expected_json tests/constant-0.5.1.sol "constant-function"
#generate_expected_json tests/incorrect_equality.sol "incorrect-equality" #generate_expected_json tests/incorrect_equality.sol "incorrect-equality"
#generate_expected_json tests/too_many_digits.sol "too-many-digits" #generate_expected_json tests/too_many_digits.sol "too-many-digits"
#generate_expected_json tests/unchecked_lowlevel-0.5.1.sol "unchecked-lowlevel"
#generate_expected_json tests/unchecked_send-0.5.1.sol "unchecked-send"

@ -1,4 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# TODO: temporary until the next crytic-compile release
git clone https://github.com/crytic/crytic-compile
cd crytic-compile
git checkout dev
python setup.py install
cd ..
python setup.py install python setup.py install
# Used by travis_test.sh # Used by travis_test.sh
pip install deepdiff pip install deepdiff

@ -69,6 +69,7 @@ test_slither(){
} }
test_slither tests/unchecked_lowlevel.sol "unchecked-lowlevel"
test_slither tests/deprecated_calls.sol "deprecated-standards" test_slither tests/deprecated_calls.sol "deprecated-standards"
test_slither tests/erc20_indexed.sol "erc20-indexed" test_slither tests/erc20_indexed.sol "erc20-indexed"
test_slither tests/incorrect_erc20_interface.sol "erc20-interface" test_slither tests/incorrect_erc20_interface.sol "erc20-interface"

@ -69,6 +69,8 @@ test_slither(){
} }
test_slither tests/unchecked_lowlevel-0.5.1.sol "unchecked-lowlevel"
test_slither tests/unchecked_send-0.5.1.sol "unchecked-send"
test_slither tests/uninitialized-0.5.1.sol "uninitialized-state" test_slither tests/uninitialized-0.5.1.sol "uninitialized-state"
test_slither tests/backdoor.sol "backdoor" test_slither tests/backdoor.sol "backdoor"
test_slither tests/backdoor.sol "suicidal" test_slither tests/backdoor.sol "suicidal"

@ -24,11 +24,11 @@ from slither.utils.command_line import (output_detectors, output_results_to_mark
output_detectors_json, output_printers, output_detectors_json, output_printers,
output_to_markdown, output_wiki) output_to_markdown, output_wiki)
from crytic_compile import is_supported from crytic_compile import is_supported
from slither.exceptions import SlitherException
logging.basicConfig() logging.basicConfig()
logger = logging.getLogger("Slither") logger = logging.getLogger("Slither")
################################################################################### ###################################################################################
################################################################################### ###################################################################################
# region Process functions # region Process functions
@ -99,12 +99,27 @@ def process_files(filenames, args, detector_classes, printer_classes):
################################################################################### ###################################################################################
################################################################################### ###################################################################################
def wrap_json_stdout(success, error_message, results=None):
return {
"success": success,
"error": error_message,
"results": results
}
def output_json(results, filename): def output_json(results, filename):
if os.path.isfile(filename): json_result = wrap_json_stdout(True, None, results)
logger.info(yellow(f'{filename} exists already, the overwrite is prevented')) if filename is None:
# Write json to console
print(json.dumps(json_result))
else: else:
with open(filename, 'w', encoding='utf8') as f: # Write json to file
json.dump(results, f, indent=2) if os.path.isfile(filename):
logger.info(yellow(f'{filename} exists already, the overwrite is prevented'))
else:
with open(filename, 'w', encoding='utf8') as f:
json.dump(json_result, f, indent=2)
# endregion # endregion
################################################################################### ###################################################################################
@ -327,7 +342,7 @@ def parse_args(detector_classes, printer_classes):
group_misc.add_argument('--json', group_misc.add_argument('--json',
help='Export results as JSON', help='Export the results as a JSON file ("--json -" to export to stdout)',
action='store', action='store',
default=defaults_flag_in_config['json']) default=defaults_flag_in_config['json'])
@ -474,14 +489,15 @@ class FormatterCryticCompile(logging.Formatter):
txt = '\n'.join(txt) txt = '\n'.join(txt)
record.args = (record.args[0], txt) record.args = (record.args[0], txt)
return super().format(record) return super().format(record)
# endregion
# endregion
################################################################################### ###################################################################################
################################################################################### ###################################################################################
# region Main # region Main
################################################################################### ###################################################################################
################################################################################### ###################################################################################
def main(): def main():
detectors, printers = get_detectors_and_printers() detectors, printers = get_detectors_and_printers()
@ -498,6 +514,11 @@ def main_impl(all_detector_classes, all_printer_classes):
# Set colorization option # Set colorization option
set_colorization_enabled(not args.disable_color) set_colorization_enabled(not args.disable_color)
# If we are outputting json to stdout, we'll want to disable any logging.
stdout_json = args.json == "-"
if stdout_json:
logging.disable(logging.CRITICAL)
printer_classes = choose_printers(args, all_printer_classes) printer_classes = choose_printers(args, all_printer_classes)
detector_classes = choose_detectors(args, all_detector_classes) detector_classes = choose_detectors(args, all_detector_classes)
@ -556,7 +577,7 @@ def main_impl(all_detector_classes, all_printer_classes):
raise Exception("Unrecognised file/dir path: '#{filename}'".format(filename=filename)) raise Exception("Unrecognised file/dir path: '#{filename}'".format(filename=filename))
if args.json: if args.json:
output_json(results, args.json) output_json(results, None if stdout_json else args.json)
if args.checklist: if args.checklist:
output_results_to_markdown(results) output_results_to_markdown(results)
# Dont print the number of result for printers # Dont print the number of result for printers
@ -570,9 +591,23 @@ def main_impl(all_detector_classes, all_printer_classes):
return return
exit(results) exit(results)
except SlitherException as se:
# Output our error accordingly, via JSON or logging.
if stdout_json:
print(json.dumps(wrap_json_stdout(False, repr(se), [])))
else:
logging.error(red('Error:'))
logging.error(red(se))
logging.error('Please report an issue to https://github.com/crytic/slither/issues')
sys.exit(-1)
except Exception: except Exception:
logging.error('Error in %s' % args.filename) # Output our error accordingly, via JSON or logging.
logging.error(traceback.format_exc()) if stdout_json:
print(json.dumps(wrap_json_stdout(False, traceback.format_exc(), [])))
else:
logging.error('Error in %s' % args.filename)
logging.error(traceback.format_exc())
sys.exit(-1) sys.exit(-1)
@ -581,4 +616,6 @@ if __name__ == '__main__':
main() main()
# endregion # endregion

@ -0,0 +1,7 @@
"""
This module import all slither exceptions
"""
from slither.slithir.exceptions import SlithIRError
from slither.solc_parsing.exceptions import ParsingError, ParsingContractNotFound, ParsingNameReuse
from slither.core.exceptions import SlitherCoreError
from slither.exceptions import SlitherException

@ -33,6 +33,8 @@ def _visit(node, visited, variables_written, variables_to_write):
variables_written = variables_written + [ir.lvalue] variables_written = variables_written + [ir.lvalue]
lvalue = ir.lvalue lvalue = ir.lvalue
while isinstance(lvalue, ReferenceVariable): while isinstance(lvalue, ReferenceVariable):
if lvalue not in refs:
break
variables_written = variables_written + [refs[lvalue]] variables_written = variables_written + [refs[lvalue]]
lvalue = refs[lvalue] lvalue = refs[lvalue]

@ -5,6 +5,9 @@ import logging
from slither.core.children.child_slither import ChildSlither from slither.core.children.child_slither import ChildSlither
from slither.core.source_mapping.source_mapping import SourceMapping from slither.core.source_mapping.source_mapping import SourceMapping
from slither.core.declarations.function import Function from slither.core.declarations.function import Function
from slither.utils.erc import ERC20_signatures, \
ERC165_signatures, ERC223_signatures, ERC721_signatures, \
ERC1820_signatures, ERC777_signatures
logger = logging.getLogger("Contract") logger = logging.getLogger("Contract")
@ -35,6 +38,8 @@ class Contract(ChildSlither, SourceMapping):
self._using_for = {} self._using_for = {}
self._kind = None self._kind = None
self._signatures = None
self._initial_state_variables = [] # ssa self._initial_state_variables = [] # ssa
@ -212,6 +217,20 @@ class Contract(ChildSlither, SourceMapping):
################################################################################### ###################################################################################
################################################################################### ###################################################################################
@property
def functions_signatures(self):
"""
Return the signatures of all the public/eterxnal functions/state variables
:return: list(string) the signatures of all the functions that can be called
"""
if self._signatures == None:
sigs = [v.full_name for v in self.state_variables if v.visibility in ['public',
'external']]
sigs += set([f.full_name for f in self.functions if f.visibility in ['public', 'external']])
self._signatures = list(set(sigs))
return self._signatures
@property @property
def functions(self): def functions(self):
''' '''
@ -534,50 +553,101 @@ class Contract(ChildSlither, SourceMapping):
################################################################################### ###################################################################################
################################################################################### ###################################################################################
def ercs(self):
"""
Return the ERC implemented
:return: list of string
"""
all = [('ERC20', lambda x: x.is_erc20()),
('ERC165', lambda x: x.is_erc165()),
('ERC1820', lambda x: x.is_erc1820()),
('ERC223', lambda x: x.is_erc223()),
('ERC721', lambda x: x.is_erc721()),
('ERC777', lambda x: x.is_erc777())]
return [erc[0] for erc in all if erc[1](self)]
def is_erc20(self): def is_erc20(self):
""" """
Check if the contract is an erc20 token Check if the contract is an erc20 token
Note: it does not check for correct return values Note: it does not check for correct return values
Returns: :return: Returns a true if the contract is an erc20
bool
""" """
full_names = set([f.full_name for f in self.functions]) full_names = self.functions_signatures
return 'transfer(address,uint256)' in full_names and\ return all((s in full_names for s in ERC20_signatures))
'transferFrom(address,address,uint256)' in full_names and\
'approve(address,uint256)' in full_names def is_erc165(self):
"""
Check if the contract is an erc165 token
Note: it does not check for correct return values
:return: Returns a true if the contract is an erc165
"""
full_names = self.functions_signatures
return all((s in full_names for s in ERC165_signatures))
def is_erc1820(self):
"""
Check if the contract is an erc1820
Note: it does not check for correct return values
:return: Returns a true if the contract is an erc165
"""
full_names = self.functions_signatures
return all((s in full_names for s in ERC1820_signatures))
def is_erc223(self):
"""
Check if the contract is an erc223 token
Note: it does not check for correct return values
:return: Returns a true if the contract is an erc223
"""
full_names = self.functions_signatures
return all((s in full_names for s in ERC223_signatures))
def is_erc721(self): def is_erc721(self):
full_names = set([f.full_name for f in self.functions]) """
return self.is_erc20() and\ Check if the contract is an erc721 token
'ownerOf(uint256)' in full_names and\
'safeTransferFrom(address,address,uint256,bytes)' in full_names and\ Note: it does not check for correct return values
'safeTransferFrom(address,address,uint256)' in full_names and\ :return: Returns a true if the contract is an erc721
'setApprovalForAll(address,bool)' in full_names and\ """
'getApproved(uint256)' in full_names and\ full_names = self.functions_signatures
'isApprovedForAll(address,address)' in full_names return all((s in full_names for s in ERC721_signatures))
def is_erc777(self):
"""
Check if the contract is an erc777
def has_an_erc20_function(self): Note: it does not check for correct return values
:return: Returns a true if the contract is an erc165
"""
full_names = self.functions_signatures
return all((s in full_names for s in ERC777_signatures))
def is_possible_erc20(self):
""" """
Checks if the provided contract could be attempting to implement ERC20 standards. Checks if the provided contract could be attempting to implement ERC20 standards.
:param contract: The contract to check for token compatibility. :param contract: The contract to check for token compatibility.
:return: Returns a boolean indicating if the provided contract met the token standard. :return: Returns a boolean indicating if the provided contract met the token standard.
""" """
full_names = set([f.full_name for f in self.functions]) # We do not check for all the functions, as name(), symbol(), might give too many FPs
full_names = self.functions_signatures
return 'transfer(address,uint256)' in full_names or \ return 'transfer(address,uint256)' in full_names or \
'transferFrom(address,address,uint256)' in full_names or \ 'transferFrom(address,address,uint256)' in full_names or \
'approve(address,uint256)' in full_names 'approve(address,uint256)' in full_names
def has_an_erc721_function(self): def is_possible_erc721(self):
""" """
Checks if the provided contract could be attempting to implement ERC721 standards. Checks if the provided contract could be attempting to implement ERC721 standards.
:param contract: The contract to check for token compatibility. :param contract: The contract to check for token compatibility.
:return: Returns a boolean indicating if the provided contract met the token standard. :return: Returns a boolean indicating if the provided contract met the token standard.
""" """
full_names = set([f.full_name for f in self.functions]) # We do not check for all the functions, as name(), symbol(), might give too many FPs
return self.has_an_erc20_function() and \ full_names = self.functions_signatures
('ownerOf(uint256)' in full_names or return ('ownerOf(uint256)' in full_names or
'safeTransferFrom(address,address,uint256,bytes)' in full_names or 'safeTransferFrom(address,address,uint256,bytes)' in full_names or
'safeTransferFrom(address,address,uint256)' in full_names or 'safeTransferFrom(address,address,uint256)' in full_names or
'setApprovalForAll(address,bool)' in full_names or 'setApprovalForAll(address,bool)' in full_names or
@ -585,6 +655,17 @@ class Contract(ChildSlither, SourceMapping):
'isApprovedForAll(address,address)' in full_names) 'isApprovedForAll(address,address)' in full_names)
# endregion
###################################################################################
###################################################################################
# region Dependencies
###################################################################################
###################################################################################
def is_from_dependency(self):
if self.slither.crytic_compile is None:
return False
return self.slither.crytic_compile.is_dependency(self.source_mapping['filename_absolute'])
# endregion # endregion
################################################################################### ###################################################################################

@ -0,0 +1,3 @@
from slither.exceptions import SlitherException
class SlitherCoreError(SlitherException): pass

@ -1,7 +1,7 @@
import logging import logging
from slither.core.expressions.expression_typed import ExpressionTyped from slither.core.expressions.expression_typed import ExpressionTyped
from slither.core.expressions.expression import Expression from slither.core.expressions.expression import Expression
from slither.core.exceptions import SlitherCoreError
logger = logging.getLogger("AssignmentOperation") logger = logging.getLogger("AssignmentOperation")
@ -43,8 +43,7 @@ class AssignmentOperationType:
if operation_type == '%=': if operation_type == '%=':
return AssignmentOperationType.ASSIGN_MODULO return AssignmentOperationType.ASSIGN_MODULO
logger.error('get_type: Unknown operation type {})'.format(operation_type)) raise SlitherCoreError('get_type: Unknown operation type {})'.format(operation_type))
exit(-1)
@staticmethod @staticmethod
def str(operation_type): def str(operation_type):
@ -71,8 +70,7 @@ class AssignmentOperationType:
if operation_type == AssignmentOperationType.ASSIGN_MODULO: if operation_type == AssignmentOperationType.ASSIGN_MODULO:
return '%=' return '%='
logger.error('str: Unknown operation type {})'.format(operation_type)) raise SlitherCoreError('str: Unknown operation type {})'.format(operation_type))
exit(-1)
class AssignmentOperation(ExpressionTyped): class AssignmentOperation(ExpressionTyped):

@ -1,7 +1,7 @@
import logging import logging
from slither.core.expressions.expression_typed import ExpressionTyped from slither.core.expressions.expression_typed import ExpressionTyped
from slither.core.expressions.expression import Expression from slither.core.expressions.expression import Expression
from slither.core.exceptions import SlitherCoreError
logger = logging.getLogger("BinaryOperation") logger = logging.getLogger("BinaryOperation")
@ -67,8 +67,7 @@ class BinaryOperationType:
if operation_type == '||': if operation_type == '||':
return BinaryOperationType.OROR return BinaryOperationType.OROR
logger.error('get_type: Unknown operation type {})'.format(operation_type)) raise SlitherCoreError('get_type: Unknown operation type {})'.format(operation_type))
exit(-1)
@staticmethod @staticmethod
def str(operation_type): def str(operation_type):
@ -110,8 +109,7 @@ class BinaryOperationType:
return '&&' return '&&'
if operation_type == BinaryOperationType.OROR: if operation_type == BinaryOperationType.OROR:
return '||' return '||'
logger.error('str: Unknown operation type {})'.format(operation_type)) raise SlitherCoreError('str: Unknown operation type {})'.format(operation_type))
exit(-1)
class BinaryOperation(ExpressionTyped): class BinaryOperation(ExpressionTyped):

@ -1,7 +1,7 @@
import logging import logging
from slither.core.expressions.expression_typed import ExpressionTyped from slither.core.expressions.expression_typed import ExpressionTyped
from slither.core.expressions.expression import Expression from slither.core.expressions.expression import Expression
from slither.core.solidity_types.type import Type from slither.core.exceptions import SlitherCoreError
logger = logging.getLogger("UnaryOperation") logger = logging.getLogger("UnaryOperation")
@ -38,8 +38,7 @@ class UnaryOperationType:
return UnaryOperationType.PLUSPLUS_POST return UnaryOperationType.PLUSPLUS_POST
if operation_type == '--': if operation_type == '--':
return UnaryOperationType.MINUSMINUS_POST return UnaryOperationType.MINUSMINUS_POST
logger.error('get_type: Unknown operation type {}'.format(operation_type)) raise SlitherCoreError('get_type: Unknown operation type {}'.format(operation_type))
exit(-1)
@staticmethod @staticmethod
def str(operation_type): def str(operation_type):
@ -58,8 +57,7 @@ class UnaryOperationType:
if operation_type in [UnaryOperationType.MINUSMINUS_PRE, UnaryOperationType.MINUSMINUS_POST]: if operation_type in [UnaryOperationType.MINUSMINUS_PRE, UnaryOperationType.MINUSMINUS_POST]:
return '--' return '--'
logger.error('str: Unknown operation type {}'.format(operation_type)) raise SlitherCoreError('str: Unknown operation type {}'.format(operation_type))
exit(-1)
@staticmethod @staticmethod
def is_prefix(operation_type): def is_prefix(operation_type):
@ -74,8 +72,7 @@ class UnaryOperationType:
elif operation_type in [UnaryOperationType.PLUSPLUS_POST, UnaryOperationType.MINUSMINUS_POST]: elif operation_type in [UnaryOperationType.PLUSPLUS_POST, UnaryOperationType.MINUSMINUS_POST]:
return False return False
logger.error('is_prefix: Unknown operation type {}'.format(operation_type)) raise SlitherCoreError('is_prefix: Unknown operation type {}'.format(operation_type))
exit(-1)
class UnaryOperation(ExpressionTyped): class UnaryOperation(ExpressionTyped):

@ -1,8 +1,53 @@
from .variable import Variable from .variable import Variable
from slither.core.children.child_contract import ChildContract from slither.core.children.child_contract import ChildContract
from slither.utils.type import export_nested_types_from_variable
class StateVariable(ChildContract, Variable): class StateVariable(ChildContract, Variable):
###################################################################################
###################################################################################
# region Signature
###################################################################################
###################################################################################
@property
def signature(self):
"""
Return the signature of the state variable as a function signature
:return: (str, list(str), list(str)), as (name, list parameters type, list return values type)
"""
return self.name, [str(x) for x in export_nested_types_from_variable(self)], self.type
@property
def signature_str(self):
"""
Return the signature of the state variable as a function signature
:return: str: func_name(type1,type2) returns(type3)
"""
name, parameters, returnVars = self.signature
return name+'('+','.join(parameters)+') returns('+','.join(returnVars)+')'
# endregion
###################################################################################
###################################################################################
# region Name
###################################################################################
###################################################################################
@property @property
def canonical_name(self): def canonical_name(self):
return '{}:{}'.format(self.contract.name, self.name) return '{}:{}'.format(self.contract.name, self.name)
@property
def full_name(self):
"""
Return the name of the state variable as a function signaure
str: func_name(type1,type2)
:return: the function signature without the return values
"""
name, parameters, _ = self.signature
return name+'('+','.join(parameters)+')'
# endregion
###################################################################################
###################################################################################

@ -34,5 +34,7 @@ from .erc.unindexed_event_parameters import UnindexedERC20EventParameters
from .statements.deprecated_calls import DeprecatedStandards from .statements.deprecated_calls import DeprecatedStandards
from .source.rtlo import RightToLeftOverride from .source.rtlo import RightToLeftOverride
from .statements.too_many_digits import TooManyDigits from .statements.too_many_digits import TooManyDigits
from .operations.unchecked_low_level_return_values import UncheckedLowLevel
from .operations.unchecked_send_return_value import UncheckedSend
# #
# #

@ -62,15 +62,16 @@ contract Token{
list(str) : list of incorrect function signatures list(str) : list of incorrect function signatures
""" """
# Verify this is an ERC20 contract. # Verify this is an ERC20 contract.
if not contract.has_an_erc20_function(): if not contract.is_possible_erc20():
return [] return []
# If this contract implements a function from ERC721, we can assume it is an ERC721 token. These tokens # If this contract implements a function from ERC721, we can assume it is an ERC721 token. These tokens
# offer functions which are similar to ERC20, but are not compatible. # offer functions which are similar to ERC20, but are not compatible.
if contract.has_an_erc721_function(): if contract.is_possible_erc721():
return [] return []
functions = [f for f in contract.functions if IncorrectERC20InterfaceDetection.incorrect_erc20_interface(f.signature)] funcs = contract.functions
functions = [f for f in funcs if IncorrectERC20InterfaceDetection.incorrect_erc20_interface(f.signature)]
return functions return functions
def _detect(self): def _detect(self):
@ -80,7 +81,7 @@ contract Token{
dict: [contract name] = set(str) events dict: [contract name] = set(str) events
""" """
results = [] results = []
for c in self.contracts: for c in self.slither.contracts_derived:
functions = IncorrectERC20InterfaceDetection.detect_incorrect_erc20_interface(c) functions = IncorrectERC20InterfaceDetection.detect_incorrect_erc20_interface(c)
if functions: if functions:
for function in functions: for function in functions:

@ -68,10 +68,11 @@ contract Token{
""" """
# Verify this is an ERC721 contract. # Verify this is an ERC721 contract.
if not contract.has_an_erc721_function() or not contract.has_an_erc20_function(): if not contract.is_possible_erc721() or not contract.is_possible_erc20():
return [] return []
functions = [f for f in contract.functions if IncorrectERC721InterfaceDetection.incorrect_erc721_interface(f.signature)] funcs = contract.functions
functions = [f for f in funcs if IncorrectERC721InterfaceDetection.incorrect_erc721_interface(f.signature)]
return functions return functions
def _detect(self): def _detect(self):
@ -81,7 +82,7 @@ contract Token{
dict: [contract name] = set(str) events dict: [contract name] = set(str) events
""" """
results = [] results = []
for c in self.contracts: for c in self.slither.contracts_derived:
functions = IncorrectERC721InterfaceDetection.detect_incorrect_erc721_interface(c) functions = IncorrectERC721InterfaceDetection.detect_incorrect_erc721_interface(c)
if functions: if functions:
for function in functions: for function in functions:

@ -0,0 +1,43 @@
"""
Module detecting unused return values from low level
"""
from slither.detectors.abstract_detector import DetectorClassification
from .unused_return_values import UnusedReturnValues
from slither.slithir.operations import LowLevelCall
class UncheckedLowLevel(UnusedReturnValues):
"""
If the return value of a send is not checked, it might lead to losing ether
"""
ARGUMENT = 'unchecked-lowlevel'
HELP = 'Unchecked low-level calls'
IMPACT = DetectorClassification.MEDIUM
CONFIDENCE = DetectorClassification.MEDIUM
WIKI = 'https://github.com/crytic/slither/wiki/Detector-Documentation#unchecked-low-level'
WIKI_TITLE = 'Unchecked low-level calls'
WIKI_DESCRIPTION = 'The return value of a low-level call is not checked.'
WIKI_EXPLOIT_SCENARIO = '''
```solidity
contract MyConc{
function my_func(address payable dst) public payable{
dst.call.value(msg.value)("");
}
}
```
The return value of the low-level call is not checked. As a result if the callfailed, the ether will be locked in the contract.
If the low level is used to prevent blocking operations, consider logging failed calls.
'''
WIKI_RECOMMENDATION = 'Ensure that the return value of low-level call is checked or logged.'
_txt_description = "low-level calls"
def _is_instance(self, ir):
return isinstance(ir, LowLevelCall)

@ -0,0 +1,40 @@
"""
Module detecting unused return values from send
"""
from slither.detectors.abstract_detector import DetectorClassification
from .unused_return_values import UnusedReturnValues
from slither.slithir.operations import Send
class UncheckedSend(UnusedReturnValues):
"""
If the return value of a send is not checked, it might lead to losing ether
"""
ARGUMENT = 'unchecked-send'
HELP = 'Unchecked send'
IMPACT = DetectorClassification.MEDIUM
CONFIDENCE = DetectorClassification.MEDIUM
WIKI = 'https://github.com/crytic/slither/wiki/Detector-Documentation#unchecked-send'
WIKI_TITLE = 'Unchecked Send'
WIKI_DESCRIPTION = 'The return value of a send is not checked.'
WIKI_EXPLOIT_SCENARIO = '''
```solidity
contract MyConc{
function my_func(address payable dst) public payable{
dst.send(msg.value);
}
}
```
The return value of `send` is not checked. As a result if the send failed, the ether will be locked in the contract.
If `send` is used to prevent blocking operations, consider logging the failed sent.
'''
WIKI_RECOMMENDATION = 'Ensure that the return value of send is checked or logged.'
_txt_description = "send calls"
def _is_instance(self, ir):
return isinstance(ir, Send)

@ -2,9 +2,8 @@
Module detecting unused return values from external calls Module detecting unused return values from external calls
""" """
from collections import defaultdict
from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification
from slither.slithir.operations.high_level_call import HighLevelCall from slither.slithir.operations import HighLevelCall, InternalCall, InternalDynamicCall
from slither.core.variables.state_variable import StateVariable from slither.core.variables.state_variable import StateVariable
class UnusedReturnValues(AbstractDetector): class UnusedReturnValues(AbstractDetector):
@ -19,7 +18,6 @@ class UnusedReturnValues(AbstractDetector):
WIKI = 'https://github.com/crytic/slither/wiki/Detector-Documentation#unused-return' WIKI = 'https://github.com/crytic/slither/wiki/Detector-Documentation#unused-return'
WIKI_TITLE = 'Unused return' WIKI_TITLE = 'Unused return'
WIKI_DESCRIPTION = 'The return value of an external call is not stored in a local or state variable.' WIKI_DESCRIPTION = 'The return value of an external call is not stored in a local or state variable.'
WIKI_EXPLOIT_SCENARIO = ''' WIKI_EXPLOIT_SCENARIO = '''
@ -33,7 +31,12 @@ contract MyConc{
``` ```
`MyConc` calls `add` of SafeMath, but does not store the result in `a`. As a result, the computation has no effect.''' `MyConc` calls `add` of SafeMath, but does not store the result in `a`. As a result, the computation has no effect.'''
WIKI_RECOMMENDATION = 'Ensure that all the return values of the function calls are stored in a local or state variable.' WIKI_RECOMMENDATION = 'Ensure that all the return values of the function calls are used.'
_txt_description = "external calls"
def _is_instance(self, ir):
return isinstance(ir, HighLevelCall)
def detect_unused_return_values(self, f): def detect_unused_return_values(self, f):
""" """
@ -47,7 +50,7 @@ contract MyConc{
nodes_origin = {} nodes_origin = {}
for n in f.nodes: for n in f.nodes:
for ir in n.irs: for ir in n.irs:
if isinstance(ir, HighLevelCall): if self._is_instance(ir):
# if a return value is stored in a state variable, it's ok # if a return value is stored in a state variable, it's ok
if ir.lvalue and not isinstance(ir.lvalue, StateVariable): if ir.lvalue and not isinstance(ir.lvalue, StateVariable):
values_returned.append(ir.lvalue) values_returned.append(ir.lvalue)
@ -69,12 +72,13 @@ contract MyConc{
unused_return = self.detect_unused_return_values(f) unused_return = self.detect_unused_return_values(f)
if unused_return: if unused_return:
for node in unused_return: for node in unused_return:
info = "{}.{} ({}) ignores return value by external call \"{}\" ({})\n" info = "{}.{} ({}) ignores return value by {} \"{}\" ({})\n"
info = info.format(f.contract.name, info = info.format(f.contract.name,
f.name, f.name,
f.source_mapping_str, f.source_mapping_str,
node.expression, self._txt_description,
node.source_mapping_str) node.expression,
node.source_mapping_str)
json = self.generate_json_result(info) json = self.generate_json_result(info)
self.add_node_to_json(node, json) self.add_node_to_json(node, json)
@ -82,3 +86,4 @@ contract MyConc{
results.append(json) results.append(json)
return results return results

@ -0,0 +1,3 @@
class SlitherException(Exception): pass
class SlitherError(SlitherException): pass

@ -6,7 +6,7 @@ import logging
from slither.printers.abstract_printer import AbstractPrinter from slither.printers.abstract_printer import AbstractPrinter
from slither.utils.code_complexity import compute_cyclomatic_complexity from slither.utils.code_complexity import compute_cyclomatic_complexity
from slither.utils.colors import green, red, yellow from slither.utils.colors import green, red, yellow
from slither.utils.standard_libraries import is_standard_library
class PrinterHumanSummary(AbstractPrinter): class PrinterHumanSummary(AbstractPrinter):
ARGUMENT = 'human-summary' ARGUMENT = 'human-summary'
@ -88,8 +88,14 @@ class PrinterHumanSummary(AbstractPrinter):
issues_informational, issues_low, issues_medium, issues_high = self._get_detectors_result() issues_informational, issues_low, issues_medium, issues_high = self._get_detectors_result()
txt = "Number of informational issues: {}\n".format(green(issues_informational)) txt = "Number of informational issues: {}\n".format(green(issues_informational))
txt += "Number of low issues: {}\n".format(green(issues_low)) txt += "Number of low issues: {}\n".format(green(issues_low))
txt += "Number of medium issues: {}\n".format(yellow(issues_medium)) if issues_medium > 0:
txt += "Number of high issues: {}\n".format(red(issues_high)) txt += "Number of medium issues: {}\n".format(yellow(issues_medium))
else:
txt += "Number of medium issues: {}\n".format(green(issues_medium))
if issues_high > 0:
txt += "Number of high issues: {}\n".format(red(issues_high))
else:
txt += "Number of high issues: {}\n\n".format(green(issues_high))
return txt return txt
@ -119,6 +125,49 @@ class PrinterHumanSummary(AbstractPrinter):
def _number_functions(contract): def _number_functions(contract):
return len(contract.functions) return len(contract.functions)
def _lines_number(self):
if not self.slither.source_code:
return None
total_dep_lines = 0
total_lines = 0
for filename, source_code in self.slither.source_code.items():
lines = len(source_code.splitlines())
is_dep = False
if self.slither.crytic_compile:
is_dep = self.slither.crytic_compile.is_dependency(filename)
if is_dep:
total_dep_lines += lines
else:
total_lines += lines
return total_lines, total_dep_lines
def _compilation_type(self):
if self.slither.crytic_compile is None:
return 'Compilation non standard\n'
return f'Compiled with {self.slither.crytic_compile.type}\n'
def _number_contracts(self):
if self.slither.crytic_compile is None:
len(self.slither.contracts), 0
deps = [c for c in self.slither.contracts if c.is_from_dependency()]
contracts = [c for c in self.slither.contracts if not c.is_from_dependency()]
return len(contracts), len(deps)
def _standard_libraries(self):
libraries = []
for contract in self.contracts:
lib = is_standard_library(contract)
if lib:
libraries.append(lib)
return libraries
def _ercs(self):
ercs = []
for contract in self.contracts:
ercs += contract.ercs()
return list(set(ercs))
def output(self, _filename): def output(self, _filename):
""" """
_filename is not used _filename is not used
@ -126,15 +175,37 @@ class PrinterHumanSummary(AbstractPrinter):
_filename(string) _filename(string)
""" """
txt = "Analyze of {}\n".format(self.slither.filename) txt = "\n"
txt += self._compilation_type()
lines_number = self._lines_number()
if lines_number:
total_lines, total_dep_lines = lines_number
txt += f'Number of lines: {total_lines} (+ {total_dep_lines} in dependencies)\n'
number_contracts, number_contracts_deps = self._number_contracts()
txt += f'Number of contracts: {number_contracts} (+ {number_contracts_deps} in dependencies) \n\n'
txt += self.get_detectors_result() txt += self.get_detectors_result()
libs = self._standard_libraries()
if libs:
txt += f'\nUse: {", ".join(libs)}\n'
ercs = self._ercs()
if ercs:
txt += f'ERCs: {", ".join(ercs)}\n'
for contract in self.slither.contracts_derived: for contract in self.slither.contracts_derived:
txt += "\nContract {}\n".format(contract.name) txt += "\nContract {}\n".format(contract.name)
txt += self.is_complex_code(contract) txt += self.is_complex_code(contract)
txt += '\tNumber of functions: {}\n'.format(self._number_functions(contract))
ercs = contract.ercs()
if ercs:
txt += '\tERCs: ' + ','.join(ercs) + '\n'
is_erc20 = contract.is_erc20() is_erc20 = contract.is_erc20()
txt += '\tNumber of functions:{}'.format(self._number_functions(contract))
txt += "\tIs ERC20 token: {}\n".format(contract.is_erc20())
if is_erc20: if is_erc20:
txt += '\tERC20 info:\n'
txt += self.get_summary_erc20(contract) txt += self.get_summary_erc20(contract)
self.info(txt) self.info(txt)

@ -11,7 +11,7 @@ from crytic_compile import CryticCompile, InvalidCompilation
from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification
from slither.printers.abstract_printer import AbstractPrinter from slither.printers.abstract_printer import AbstractPrinter
from .solc_parsing.slitherSolc import SlitherSolc from .solc_parsing.slitherSolc import SlitherSolc
from .utils.colors import red from .exceptions import SlitherError
logger = logging.getLogger("Slither") logger = logging.getLogger("Slither")
logging.basicConfig() logging.basicConfig()
@ -44,10 +44,6 @@ class Slither(SlitherSolc):
embark_overwrite_config (bool): overwrite original config file (default false) embark_overwrite_config (bool): overwrite original config file (default false)
''' '''
truffle_ignore = kwargs.get('truffle_ignore', False)
embark_ignore = kwargs.get('embark_ignore', False)
# list of files provided (see --splitted option) # list of files provided (see --splitted option)
if isinstance(contract, list): if isinstance(contract, list):
self._init_from_list(contract) self._init_from_list(contract)
@ -56,14 +52,11 @@ class Slither(SlitherSolc):
else: else:
super(Slither, self).__init__('') super(Slither, self).__init__('')
try: try:
cryticCompile = CryticCompile(contract, **kwargs) crytic_compile = CryticCompile(contract, **kwargs)
self._crytic_compile = cryticCompile self._crytic_compile = crytic_compile
except InvalidCompilation as e: except InvalidCompilation as e:
logger.error('Invalid compilation') raise SlitherError('Invalid compilation: \n'+str(e))
logger.error(e) for path, ast in crytic_compile.asts.items():
exit(-1)
for path, ast in cryticCompile.asts.items():
self._parse_contracts_from_loaded_json(ast, path) self._parse_contracts_from_loaded_json(ast, path)
self._add_source_code(path) self._add_source_code(path)
@ -81,14 +74,12 @@ class Slither(SlitherSolc):
def _init_from_raw_json(self, filename): def _init_from_raw_json(self, filename):
if not os.path.isfile(filename): if not os.path.isfile(filename):
logger.error('{} does not exist (are you in the correct directory?)'.format(filename)) raise SlitherError('{} does not exist (are you in the correct directory?)'.format(filename))
exit(-1)
assert filename.endswith('json') assert filename.endswith('json')
with open(filename, encoding='utf8') as astFile: with open(filename, encoding='utf8') as astFile:
stdout = astFile.read() stdout = astFile.read()
if not stdout: if not stdout:
logger.info('Empty AST file: %s', filename) raise SlitherError('Empty AST file: %s', filename)
sys.exit(-1)
contracts_json = stdout.split('\n=') contracts_json = stdout.split('\n=')
super(Slither, self).__init__(filename) super(Slither, self).__init__(filename)
@ -169,21 +160,19 @@ class Slither(SlitherSolc):
) )
) )
if any(isinstance(obj, cls) for obj in instances_list): if any(type(obj) == cls for obj in instances_list):
raise Exception( raise Exception(
"You can't register {!r} twice.".format(cls) "You can't register {!r} twice.".format(cls)
) )
def _run_solc(self, filename, solc, disable_solc_warnings, solc_arguments, ast_format): def _run_solc(self, filename, solc, disable_solc_warnings, solc_arguments, ast_format):
if not os.path.isfile(filename): if not os.path.isfile(filename):
logger.error('{} does not exist (are you in the correct directory?)'.format(filename)) raise SlitherError('{} does not exist (are you in the correct directory?)'.format(filename))
exit(-1)
assert filename.endswith('json') assert filename.endswith('json')
with open(filename, encoding='utf8') as astFile: with open(filename, encoding='utf8') as astFile:
stdout = astFile.read() stdout = astFile.read()
if not stdout: if not stdout:
logger.info('Empty AST file: %s', filename) raise SlitherError('Empty AST file: %s', filename)
sys.exit(-1)
stdout = stdout.split('\n=') stdout = stdout.split('\n=')
return stdout return stdout

@ -33,6 +33,7 @@ from slither.slithir.variables import (Constant, ReferenceVariable,
from slither.visitors.slithir.expression_to_slithir import ExpressionToSlithIR from slither.visitors.slithir.expression_to_slithir import ExpressionToSlithIR
from slither.utils.function import get_function_id from slither.utils.function import get_function_id
from slither.utils.type import export_nested_types_from_variable from slither.utils.type import export_nested_types_from_variable
from slither.slithir.exceptions import SlithIRError
logger = logging.getLogger('ConvertToIR') logger = logging.getLogger('ConvertToIR')
@ -457,8 +458,7 @@ def propagate_types(ir, node):
# temporary operation; they will be removed # temporary operation; they will be removed
pass pass
else: else:
logger.error('Not handling {} during type propgation'.format(type(ir))) raise SlithIRError('Not handling {} during type propgation'.format(type(ir)))
exit(-1)
def extract_tmp_call(ins, contract): def extract_tmp_call(ins, contract):
assert isinstance(ins, TmpCall) assert isinstance(ins, TmpCall)
@ -577,8 +577,7 @@ def convert_to_low_level(ir):
new_ir.arguments = ir.arguments new_ir.arguments = ir.arguments
new_ir.lvalue.set_type(ElementaryType('bool')) new_ir.lvalue.set_type(ElementaryType('bool'))
return new_ir return new_ir
logger.error('Incorrect conversion to low level {}'.format(ir)) raise SlithIRError('Incorrect conversion to low level {}'.format(ir))
exit(-1)
def convert_to_push(ir, node): def convert_to_push(ir, node):
""" """
@ -679,6 +678,9 @@ def convert_type_library_call(ir, lib_contract):
func = lib_contract.get_function_from_signature(sig) func = lib_contract.get_function_from_signature(sig)
if not func: if not func:
func = lib_contract.get_state_variable_from_name(ir.function_name) func = lib_contract.get_state_variable_from_name(ir.function_name)
if func:
# stop to explore if func is found (prevent dupplicate issue)
break
# In case of multiple binding to the same type # In case of multiple binding to the same type
if not func: if not func:
# specific lookup when the compiler does implicit conversion # specific lookup when the compiler does implicit conversion
@ -713,6 +715,9 @@ def convert_type_of_high_and_internal_level_call(ir, contract):
func = contract.get_function_from_signature(sig) func = contract.get_function_from_signature(sig)
if not func: if not func:
func = contract.get_state_variable_from_name(ir.function_name) func = contract.get_state_variable_from_name(ir.function_name)
if func:
# stop to explore if func is found (prevent dupplicate issue)
break
if not func: if not func:
# specific lookup when the compiler does implicit conversion # specific lookup when the compiler does implicit conversion
# for example # for example

@ -0,0 +1,3 @@
from slither.exceptions import SlitherException
class SlithIRError(SlitherException): pass

@ -4,6 +4,7 @@ from slither.core.variables.variable import Variable
from slither.slithir.utils.utils import is_valid_lvalue, is_valid_rvalue from slither.slithir.utils.utils import is_valid_lvalue, is_valid_rvalue
from slither.core.solidity_types import ElementaryType from slither.core.solidity_types import ElementaryType
from slither.slithir.variables import ReferenceVariable from slither.slithir.variables import ReferenceVariable
from slither.slithir.exceptions import SlithIRError
logger = logging.getLogger("BinaryOperationIR") logger = logging.getLogger("BinaryOperationIR")
@ -80,8 +81,7 @@ class BinaryType(object):
if operation_type == '||': if operation_type == '||':
return BinaryType.OROR return BinaryType.OROR
logger.error('get_type: Unknown operation type {})'.format(operation_type)) raise SlithIRError('get_type: Unknown operation type {})'.format(operation_type))
exit(-1)
@staticmethod @staticmethod
def str(operation_type): def str(operation_type):
@ -123,8 +123,7 @@ class BinaryType(object):
return '&&' return '&&'
if operation_type == BinaryType.OROR: if operation_type == BinaryType.OROR:
return '||' return '||'
logger.error('str: Unknown operation type {})'.format(operation_type)) raise SlithIRError('str: Unknown operation type {})'.format(operation_type))
exit(-1)
class Binary(OperationWithLValue): class Binary(OperationWithLValue):

@ -40,7 +40,7 @@ class Return(Operation):
@property @property
def values(self): def values(self):
return self._values return self._unroll(self._values)
def __str__(self): def __str__(self):
return "RETURN {}".format(','.join(['{}'.format(x) for x in self.values])) return "RETURN {}".format(','.join(['{}'.format(x) for x in self.values]))

@ -1,8 +1,7 @@
import logging import logging
from slither.slithir.operations.lvalue import OperationWithLValue from slither.slithir.operations.lvalue import OperationWithLValue
from slither.core.variables.variable import Variable
from slither.slithir.utils.utils import is_valid_lvalue, is_valid_rvalue from slither.slithir.utils.utils import is_valid_lvalue, is_valid_rvalue
from slither.slithir.exceptions import SlithIRError
logger = logging.getLogger("BinaryOperationIR") logger = logging.getLogger("BinaryOperationIR")
@ -17,8 +16,7 @@ class UnaryType:
return UnaryType.BANG return UnaryType.BANG
if operation_type == '~': if operation_type == '~':
return UnaryType.TILD return UnaryType.TILD
logger.error('get_type: Unknown operation type {}'.format(operation_type)) raise SlithIRError('get_type: Unknown operation type {}'.format(operation_type))
exit(-1)
@staticmethod @staticmethod
def str(operation_type): def str(operation_type):
@ -27,8 +25,7 @@ class UnaryType:
if operation_type == UnaryType.TILD: if operation_type == UnaryType.TILD:
return '~' return '~'
logger.error('str: Unknown operation type {}'.format(operation_type)) raise SlithIRError('str: Unknown operation type {}'.format(operation_type))
exit(-1)
class Unary(OperationWithLValue): class Unary(OperationWithLValue):

@ -22,6 +22,7 @@ from slither.slithir.variables import (Constant, LocalIRVariable,
ReferenceVariable, ReferenceVariableSSA, ReferenceVariable, ReferenceVariableSSA,
StateIRVariable, TemporaryVariable, StateIRVariable, TemporaryVariable,
TemporaryVariableSSA, TupleVariable, TupleVariableSSA) TemporaryVariableSSA, TupleVariable, TupleVariableSSA)
from slither.slithir.exceptions import SlithIRError
logger = logging.getLogger('SSA_Conversion') logger = logging.getLogger('SSA_Conversion')
@ -662,7 +663,6 @@ def copy_ir(ir, *instances):
return Length(value, lvalue) return Length(value, lvalue)
logger.error('Impossible ir copy on {} ({})'.format(ir, type(ir))) raise SlithIRError('Impossible ir copy on {} ({})'.format(ir, type(ir)))
exit(-1)
# endregion # endregion

@ -13,8 +13,8 @@ class Constant(SlithIRVariable):
if type: if type:
assert isinstance(type, ElementaryType) assert isinstance(type, ElementaryType)
self._type = type self._type = type
if type.type in Int + Uint: if type.type in Int + Uint + ['address']:
if val.startswith('0x'): if val.startswith('0x') or val.startswith('0X'):
self._val = int(val, 16) self._val = int(val, 16)
else: else:
if 'e' in val: if 'e' in val:
@ -24,7 +24,7 @@ class Constant(SlithIRVariable):
base, expo = val.split('E') base, expo = val.split('E')
self._val = int(float(base) * (10 ** int(expo))) self._val = int(float(base) * (10 ** int(expo)))
else: else:
self._val = int(val) self._val = int(float(val))
elif type.type == 'bool': elif type.type == 'bool':
self._val = val == 'true' self._val = val == 'true'
else: else:

@ -9,6 +9,7 @@ from slither.solc_parsing.declarations.modifier import ModifierSolc
from slither.solc_parsing.declarations.structure import StructureSolc from slither.solc_parsing.declarations.structure import StructureSolc
from slither.solc_parsing.solidity_types.type_parsing import parse_type from slither.solc_parsing.solidity_types.type_parsing import parse_type
from slither.solc_parsing.variables.state_variable import StateVariableSolc from slither.solc_parsing.variables.state_variable import StateVariableSolc
from slither.solc_parsing.exceptions import ParsingError
logger = logging.getLogger("ContractSolcParsing") logger = logging.getLogger("ContractSolcParsing")
@ -186,8 +187,7 @@ class ContractSolc04(Contract):
elif item[self.get_key()] == 'UsingForDirective': elif item[self.get_key()] == 'UsingForDirective':
self._usingForNotParsed.append(item) self._usingForNotParsed.append(item)
else: else:
logger.error('Unknown contract item: '+item[self.get_key()]) raise ParsingError('Unknown contract item: '+item[self.get_key()])
exit(-1)
return return
def _parse_struct(self, struct): def _parse_struct(self, struct):

@ -26,6 +26,7 @@ from slither.utils.expression_manipulations import SplitTernaryExpression
from slither.utils.utils import unroll from slither.utils.utils import unroll
from slither.visitors.expression.export_values import ExportValues from slither.visitors.expression.export_values import ExportValues
from slither.visitors.expression.has_conditional import HasConditional from slither.visitors.expression.has_conditional import HasConditional
from slither.solc_parsing.exceptions import ParsingError
logger = logging.getLogger("FunctionSolc") logger = logging.getLogger("FunctionSolc")
@ -725,8 +726,7 @@ class FunctionSolc(Function):
link_nodes(node, new_node) link_nodes(node, new_node)
node = new_node node = new_node
else: else:
logger.error('Statement not parsed %s'%name) raise ParsingError('Statement not parsed %s'%name)
exit(-1)
return node return node
@ -814,8 +814,7 @@ class FunctionSolc(Function):
end_node = self._find_end_loop(node, [], 0) end_node = self._find_end_loop(node, [], 0)
if not end_node: if not end_node:
logger.error('Break in no-loop context {}'.format(node)) raise ParsingError('Break in no-loop context {}'.format(node))
exit(-1)
for son in node.sons: for son in node.sons:
son.remove_father(node) son.remove_father(node)
@ -826,8 +825,7 @@ class FunctionSolc(Function):
start_node = self._find_start_loop(node, []) start_node = self._find_start_loop(node, [])
if not start_node: if not start_node:
logger.error('Continue in no-loop context {}'.format(node.nodeId())) raise ParsingError('Continue in no-loop context {}'.format(node.nodeId()))
exit(-1)
for son in node.sons: for son in node.sons:
son.remove_father(node) son.remove_father(node)

@ -0,0 +1,7 @@
from slither.exceptions import SlitherException
class ParsingError(SlitherException): pass
class ParsingNameReuse(SlitherException): pass
class ParsingContractNotFound(SlitherException): pass

@ -35,7 +35,7 @@ from slither.core.solidity_types import (ArrayType, ElementaryType,
FunctionType, MappingType) FunctionType, MappingType)
from slither.solc_parsing.solidity_types.type_parsing import (UnknownType, from slither.solc_parsing.solidity_types.type_parsing import (UnknownType,
parse_type) parse_type)
from slither.solc_parsing.exceptions import ParsingError
logger = logging.getLogger("ExpressionParsing") logger = logging.getLogger("ExpressionParsing")
@ -78,8 +78,7 @@ def find_variable(var_name, caller_context, referenced_declaration=None):
function = caller_context function = caller_context
contract = function.contract contract = function.contract
else: else:
logger.error('Incorrect caller context') raise ParsingError('Incorrect caller context')
exit(-1)
if function: if function:
# We look for variable declared with the referencedDeclaration attr # We look for variable declared with the referencedDeclaration attr
@ -497,10 +496,17 @@ def parse_expression(expression, caller_context):
value = '0x'+expression['attributes']['hexvalue'] value = '0x'+expression['attributes']['hexvalue']
type = expression['attributes']['type'] type = expression['attributes']['type']
if type.startswith('int_const '): if type is None:
if value.isdecimal():
type = ElementaryType('uint256')
else:
type = ElementaryType('string')
elif type.startswith('int_const '):
type = ElementaryType('uint256') type = ElementaryType('uint256')
elif type.startswith('bool'): elif type.startswith('bool'):
type = ElementaryType('bool') type = ElementaryType('bool')
elif type.startswith('address'):
type = ElementaryType('address')
else: else:
type = ElementaryType('string') type = ElementaryType('string')
literal = Literal(value, type) literal = Literal(value, type)
@ -627,8 +633,7 @@ def parse_expression(expression, caller_context):
elif type_name[caller_context.get_key()] == 'FunctionTypeName': elif type_name[caller_context.get_key()] == 'FunctionTypeName':
array_type = parse_type(type_name, caller_context) array_type = parse_type(type_name, caller_context)
else: else:
logger.error('Incorrect type array {}'.format(type_name)) raise ParsingError('Incorrect type array {}'.format(type_name))
exit(-1)
array = NewArray(depth, array_type) array = NewArray(depth, array_type)
return array return array
@ -664,5 +669,5 @@ def parse_expression(expression, caller_context):
call = CallExpression(called, arguments, 'Modifier') call = CallExpression(called, arguments, 'Modifier')
return call return call
logger.error('Expression not parsed %s'%name) raise ParsingError('Expression not parsed %s'%name)
exit(-1)

@ -14,6 +14,7 @@ from slither.core.declarations.import_directive import Import
from slither.analyses.data_dependency.data_dependency import compute_dependency from slither.analyses.data_dependency.data_dependency import compute_dependency
from slither.utils.colors import red from slither.utils.colors import red
from .exceptions import ParsingNameReuse, ParsingContractNotFound
class SlitherSolc(Slither): class SlitherSolc(Slither):
@ -182,8 +183,7 @@ class SlitherSolc(Slither):
info += '\n{} is defined in:'.format(contract.name) info += '\n{} is defined in:'.format(contract.name)
info += '\n- {}\n- {}'.format(contract.source_mapping_str, info += '\n- {}\n- {}'.format(contract.source_mapping_str,
self._contracts[contract.name].source_mapping_str) self._contracts[contract.name].source_mapping_str)
logger.error(info) raise ParsingNameReuse(info)
exit(-1)
else: else:
self._contracts_by_id[contract.id] = contract self._contracts_by_id[contract.id] = contract
self._contracts[contract.name] = contract self._contracts[contract.name] = contract
@ -217,11 +217,11 @@ class SlitherSolc(Slither):
father_constructors.append(self._contracts_by_id[i]) father_constructors.append(self._contracts_by_id[i])
except KeyError: except KeyError:
logger.error(red('A contract was not found, it is likely that your codebase contains muliple contracts with the same name')) txt = 'A contract was not found, it is likely that your codebase contains muliple contracts with the same name'
logger.error(red('Truffle does not handle this case during compilation')) txt += 'Truffle does not handle this case during compilation'
logger.error(red('Please read https://github.com/trailofbits/slither/wiki#keyerror-or-nonetype-error')) txt += 'Please read https://github.com/trailofbits/slither/wiki#keyerror-or-nonetype-error'
logger.error(red('And update your code to remove the duplicate')) txt += 'And update your code to remove the duplicate'
exit(-1) raise ParsingContractNotFound(txt)
contract.setInheritance(ancestors, fathers, father_constructors) contract.setInheritance(ancestors, fathers, father_constructors)
contracts_to_be_analyzed = self.contracts contracts_to_be_analyzed = self.contracts

@ -13,6 +13,7 @@ from slither.core.declarations.function import Function
from slither.core.expressions.literal import Literal from slither.core.expressions.literal import Literal
from slither.solc_parsing.exceptions import ParsingError
import re import re
logger = logging.getLogger('TypeParsing') logger = logging.getLogger('TypeParsing')
@ -118,8 +119,7 @@ def _find_from_type_name(name, contract, contracts, structures, enums):
return MappingType(from_type, to_type) return MappingType(from_type, to_type)
if not var_type: if not var_type:
logger.error('Type not found '+str(name)) raise ParsingError('Type not found '+str(name))
exit(-1)
return UserDefinedType(var_type) return UserDefinedType(var_type)
@ -134,8 +134,7 @@ def parse_type(t, caller_context):
elif isinstance(caller_context, Function): elif isinstance(caller_context, Function):
contract = caller_context.contract contract = caller_context.contract
else: else:
logger.error('Incorrect caller context') raise ParsingError('Incorrect caller context')
exit(-1)
is_compact_ast = caller_context.is_compact_ast is_compact_ast = caller_context.is_compact_ast
@ -223,5 +222,4 @@ def parse_type(t, caller_context):
return FunctionType(params_vars, return_values_vars) return FunctionType(params_vars, return_values_vars)
logger.error('Type name not found '+str(t)) raise ParsingError('Type name not found '+str(t))
exit(-1)

@ -6,7 +6,7 @@ from slither.core.variables.variable import Variable
from slither.solc_parsing.solidity_types.type_parsing import parse_type, UnknownType from slither.solc_parsing.solidity_types.type_parsing import parse_type, UnknownType
from slither.core.solidity_types.elementary_type import ElementaryType, NonElementaryType from slither.core.solidity_types.elementary_type import ElementaryType, NonElementaryType
from slither.solc_parsing.exceptions import ParsingError
logger = logging.getLogger("VariableDeclarationSolcParsing") logger = logging.getLogger("VariableDeclarationSolcParsing")
class MultipleVariablesDeclaration(Exception): class MultipleVariablesDeclaration(Exception):
@ -51,8 +51,7 @@ class VariableDeclarationSolc(Variable):
elif nodeType == 'VariableDeclaration': elif nodeType == 'VariableDeclaration':
self._init_from_declaration(var, var['value']) self._init_from_declaration(var, var['value'])
else: else:
logger.error('Incorrect variable declaration type {}'.format(nodeType)) raise ParsingError('Incorrect variable declaration type {}'.format(nodeType))
exit(-1)
else: else:
nodeType = var['name'] nodeType = var['name']
@ -65,15 +64,13 @@ class VariableDeclarationSolc(Variable):
elif len(var['children']) > 2: elif len(var['children']) > 2:
raise MultipleVariablesDeclaration raise MultipleVariablesDeclaration
else: else:
logger.error('Variable declaration without children?'+var) raise ParsingError('Variable declaration without children?'+var)
exit(-1)
declaration = var['children'][0] declaration = var['children'][0]
self._init_from_declaration(declaration, init) self._init_from_declaration(declaration, init)
elif nodeType == 'VariableDeclaration': elif nodeType == 'VariableDeclaration':
self._init_from_declaration(var, None) self._init_from_declaration(var, None)
else: else:
logger.error('Incorrect variable declaration type {}'.format(nodeType)) raise ParsingError('Incorrect variable declaration type {}'.format(nodeType))
exit(-1)
@property @property
def initialized(self): def initialized(self):

@ -0,0 +1,69 @@
def erc_to_signatures(erc):
return [f'{e[0]}({",".join(e[1])})' for e in erc]
# Final
# https://eips.ethereum.org/EIPS/eip-20
# name, symbolc, decimals are optionals
ERC20 = [('totalSupply', [], 'uint256'),
('balanceOf', ['address'], 'uint256'),
('transfer', ['address', 'uint256'], 'bool'),
('transferFrom', ['address', 'address', 'uint256'], 'bool'),
('approve', ['address', 'uint256'], 'bool'),
('allowance', ['address', 'address'], 'uint256')]
ERC20_signatures = erc_to_signatures(ERC20)
# Draft
# https://github.com/ethereum/eips/issues/223
ERC223 = [('name', [], 'string'),
('symbol', [], 'string'),
('decimals', [], 'uint8'),
('totalSupply', [], 'uint256'),
('balanceOf', ['address'], 'uint256'),
('transfer', ['address', 'uint256'], 'bool'),
('transfer', ['address', 'uint256', 'bytes'], 'bool'),
('transfer', ['address', 'uint256', 'bytes', 'string'], 'bool')]
ERC223_signatures = erc_to_signatures(ERC223)
# Final
# https://eips.ethereum.org/EIPS/eip-165
ERC165 = [('supportsInterface', ['bytes4'], 'bool')]
ERC165_signatures = erc_to_signatures(ERC165)
# Final
# https://eips.ethereum.org/EIPS/eip-721
# Must have ERC165
# name, symbol, tokenURI are optionals
ERC721 = [('balanceOf', ['address'], 'uint256'),
('ownerOf', ['uint256'], 'address'),
('safeTransferFrom', ['address', 'address', 'uint256', 'bytes'], ''),
('safeTransferFrom', ['address', 'address', 'uint256'], ''),
('transferFrom', ['address', 'address', 'uint256'], ''),
('approve', ['address', 'uint256'], ''),
('setApprovalForAll', ['address', 'bool'], ''),
('getApproved', ['uint256'], 'address'),
('isApprovedForAll', ['address', 'address'], 'bool')] + ERC165
ERC721_signatures = erc_to_signatures(ERC721)
# Final
# https://eips.ethereum.org/EIPS/eip-1820
ERC1820 = [('canImplementInterfaceForAddress', ['bytes32', 'address'], 'bytes32')]
ERC1820_signatures = erc_to_signatures(ERC1820)
# Last Call
# https://eips.ethereum.org/EIPS/eip-777
ERC777 = [('name', [], 'string'),
('symbol', [], 'string'),
('totalSupply', [], 'uint256'),
('balanceOf', ['address'], 'uint256'),
('granularity', [], 'uint256'),
('defaultOperators', [], 'address[]'),
('isOperatorFor', ['address', 'address'], 'bool'),
('authorizeOperator', ['address'], ''),
('revokeOperator', ['address'], ''),
('send', ['address', 'uint256', 'bytes'], ''),
('operatorSend', ['address', 'address', 'uint256', 'bytes', 'bytes'], ''),
('burn', ['uint256', 'bytes'] , ''),
('operatorBurn', ['address', 'uint256', 'bytes', 'bytes'] , '')]
ERC777_signatures = erc_to_signatures(ERC777)

@ -0,0 +1,193 @@
from pathlib import Path
libraries = {
'Openzeppelin-SafeMath': lambda x: is_openzepellin_safemath(x),
'Openzeppelin-ECRecovery': lambda x: is_openzepellin_ecrecovery(x),
'Openzeppelin-Ownable': lambda x: is_openzepellin_ownable(x),
'Openzeppelin-ERC20': lambda x: is_openzepellin_erc20(x),
'Openzeppelin-ERC721': lambda x: is_openzepellin_erc721(x),
'Zos-Upgrade': lambda x: is_zos_initializable(x),
'Dapphub-DSAuth': lambda x: is_dapphub_ds_auth(x),
'Dapphub-DSMath': lambda x: is_dapphub_ds_math(x),
'Dapphub-DSToken': lambda x: is_dapphub_ds_token(x),
'Dapphub-DSProxy': lambda x: is_dapphub_ds_proxy(x),
'Dapphub-DSGroup': lambda x: is_dapphub_ds_group(x),
}
def is_standard_library(contract):
for name, is_lib in libraries.items():
if is_lib(contract):
return name
return None
###################################################################################
###################################################################################
# region General libraries
###################################################################################
###################################################################################
def is_openzepellin(contract):
if not contract.is_from_dependency():
return False
return 'openzeppelin-solidity' in Path(contract.source_mapping['filename_absolute']).parts
def is_zos(contract):
if not contract.is_from_dependency():
return False
return 'zos-lib' in Path(contract.source_mapping['filename_absolute']).parts
# endregion
###################################################################################
###################################################################################
# region SafeMath
###################################################################################
###################################################################################
def is_safemath(contract):
return contract.name == "SafeMath"
def is_openzepellin_safemath(contract):
return is_safemath(contract) and is_openzepellin(contract)
# endregion
###################################################################################
###################################################################################
# region ECRecovery
###################################################################################
###################################################################################
def is_ecrecovery(contract):
return contract.name == 'ECRecovery'
def is_openzepellin_ecrecovery(contract):
return is_ecrecovery(contract) and is_openzepellin(contract)
# endregion
###################################################################################
###################################################################################
# region Ownable
###################################################################################
###################################################################################
def is_ownable(contract):
return contract.name == 'Ownable'
def is_openzepellin_ownable(contract):
return is_ownable(contract) and is_openzepellin(contract)
# endregion
###################################################################################
###################################################################################
# region ERC20
###################################################################################
###################################################################################
def is_erc20(contract):
return contract.name == 'ERC20'
def is_openzepellin_erc20(contract):
return is_erc20(contract) and is_openzepellin(contract)
# endregion
###################################################################################
###################################################################################
# region ERC721
###################################################################################
###################################################################################
def is_erc721(contract):
return contract.name == 'ERC721'
def is_openzepellin_erc721(contract):
return is_erc721(contract) and is_openzepellin(contract)
# endregion
###################################################################################
###################################################################################
# region Zos Initializable
###################################################################################
###################################################################################
def is_initializable(contract):
return contract.name == 'Initializable'
def is_zos_initializable(contract):
return is_initializable(contract) and is_zos(contract)
# endregion
###################################################################################
###################################################################################
# region DappHub
###################################################################################
###################################################################################
dapphubs = {
'DSAuth': 'ds-auth',
'DSMath': 'ds-math',
'DSToken': 'ds-token',
'DSProxy': 'ds-proxy',
'DSGroup': 'ds-group',
}
def _is_ds(contract, name):
return contract.name == name
def _is_dappdhub_ds(contract, name):
if not contract.is_from_dependency():
return False
if not dapphubs[name] in Path(contract.source_mapping['filename_absolute']).parts:
return False
return _is_ds(contract, name)
def is_ds_auth(contract):
return _is_ds(contract, 'DSAuth')
def is_dapphub_ds_auth(contract):
return _is_dappdhub_ds(contract, 'DSAuth')
def is_ds_math(contract):
return _is_ds(contract, 'DSMath')
def is_dapphub_ds_math(contract):
return _is_dappdhub_ds(contract, 'DSMath')
def is_ds_token(contract):
return _is_ds(contract, 'DSToken')
def is_dapphub_ds_token(contract):
return _is_dappdhub_ds(contract, 'DSToken')
def is_ds_proxy(contract):
return _is_ds(contract, 'DSProxy')
def is_dapphub_ds_proxy(contract):
return _is_dappdhub_ds(contract, 'DSProxy')
def is_ds_group(contract):
return _is_ds(contract, 'DSGroup')
def is_dapphub_ds_group(contract):
return _is_dappdhub_ds(contract, 'DSGroup')

@ -1,16 +1,19 @@
from slither.core.solidity_types import (ArrayType, MappingType, ElementaryType) from slither.core.solidity_types import (ArrayType, MappingType, ElementaryType)
def _add_mapping_parameter(t, l): def _add_mapping_parameter(t, l):
while isinstance(t, MappingType): while isinstance(t, MappingType):
l.append(t.type_from) l.append(t.type_from)
t = t.type_to t = t.type_to
_add_array_parameter(t, l) _add_array_parameter(t, l)
def _add_array_parameter(t, l): def _add_array_parameter(t, l):
while isinstance(t, ArrayType): while isinstance(t, ArrayType):
l.append(ElementaryType('uint256')) l.append(ElementaryType('uint256'))
t = t.type t = t.type
def export_nested_types_from_variable(variable): def export_nested_types_from_variable(variable):
""" """
Export the list of nested types (mapping/array) Export the list of nested types (mapping/array)

@ -21,8 +21,8 @@ def set_val(expression, val):
class ConstantFolding(ExpressionVisitor): class ConstantFolding(ExpressionVisitor):
def __init__(self, expression, type): def __init__(self, expression, type):
super(ConstantFolding, self).__init__(expression)
self._type = type self._type = type
super(ConstantFolding, self).__init__(expression)
def result(self): def result(self):
return Literal(int(get_val(self._expression)), self._type) return Literal(int(get_val(self._expression)), self._type)

@ -15,12 +15,14 @@ from slither.core.expressions.new_elementary_type import NewElementaryType
from slither.core.expressions.tuple_expression import TupleExpression from slither.core.expressions.tuple_expression import TupleExpression
from slither.core.expressions.type_conversion import TypeConversion from slither.core.expressions.type_conversion import TypeConversion
from slither.core.expressions.unary_operation import UnaryOperation from slither.core.expressions.unary_operation import UnaryOperation
from slither.exceptions import SlitherError
logger = logging.getLogger("ExpressionVisitor") logger = logging.getLogger("ExpressionVisitor")
class ExpressionVisitor: class ExpressionVisitor:
def __init__(self, expression): def __init__(self, expression):
# Inherited class must declared their variables prior calling super().__init__
self._expression = expression self._expression = expression
self._result = None self._result = None
self._visit_expression(self.expression) self._visit_expression(self.expression)
@ -86,8 +88,7 @@ class ExpressionVisitor:
pass pass
else: else:
logger.error('Expression not handled: {}'.format(expression)) raise SlitherError('Expression not handled: {}'.format(expression))
exit(-1)
self._post_visit(expression) self._post_visit(expression)
@ -200,8 +201,7 @@ class ExpressionVisitor:
pass pass
else: else:
logger.error('Expression not handled: {}'.format(expression)) raise SlitherError('Expression not handled: {}'.format(expression))
exit(-1)
# pre_expression_name # pre_expression_name
@ -302,8 +302,7 @@ class ExpressionVisitor:
pass pass
else: else:
logger.error('Expression not handled: {}'.format(expression)) raise SlitherError('Expression not handled: {}'.format(expression))
exit(-1)
# post_expression_name # post_expression_name

@ -17,8 +17,7 @@ from slither.slithir.variables import (Constant, ReferenceVariable,
TemporaryVariable, TupleVariable) TemporaryVariable, TupleVariable)
from slither.visitors.expression.expression import ExpressionVisitor from slither.visitors.expression.expression import ExpressionVisitor
#from slither.slithir.variables.state_variable import StateIRVariable from slither.slithir.exceptions import SlithIRError
#from slither.slithir.variables.local_variable import LocalIRVariable
logger = logging.getLogger("VISTIOR:ExpressionToSlithIR") logger = logging.getLogger("VISTIOR:ExpressionToSlithIR")
@ -57,8 +56,7 @@ def convert_assignment(left, right, t, return_type):
elif t == AssignmentOperationType.ASSIGN_MODULO: elif t == AssignmentOperationType.ASSIGN_MODULO:
return Binary(left, left, right, BinaryType.MODULO) return Binary(left, left, right, BinaryType.MODULO)
logger.error('Missing type during assignment conversion') raise SlithIRError('Missing type during assignment conversion')
exit(-1)
class ExpressionToSlithIR(ExpressionVisitor): class ExpressionToSlithIR(ExpressionVisitor):

@ -1,204 +1,208 @@
[ {
{ "success": true,
"check": "arbitrary-send", "error": null,
"impact": "High", "results": [
"confidence": "Medium", {
"description": "Test.direct (tests/arbitrary_send-0.5.1.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/arbitrary_send-0.5.1.sol#12)\n", "check": "arbitrary-send",
"elements": [ "impact": "High",
{ "confidence": "Medium",
"type": "function", "description": "Test.direct (tests/arbitrary_send-0.5.1.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/arbitrary_send-0.5.1.sol#12)\n",
"name": "direct", "elements": [
"source_mapping": { {
"start": 162, "type": "function",
"length": 79, "name": "direct",
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/arbitrary_send-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_short": "tests/arbitrary_send-0.5.1.sol",
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Test",
"source_mapping": { "source_mapping": {
"start": 0, "start": 162,
"length": 884, "length": 79,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/arbitrary_send-0.5.1.sol", "filename_relative": "tests/arbitrary_send-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_short": "tests/arbitrary_send-0.5.1.sol", "filename_short": "tests/arbitrary_send-0.5.1.sol",
"lines": [ "lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11, 11,
12, 12,
13, 13
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 884,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/arbitrary_send-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_short": "tests/arbitrary_send-0.5.1.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "expression",
"expression": "msg.sender.send(address(this).balance)",
"source_mapping": {
"start": 196,
"length": 38,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/arbitrary_send-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_short": "tests/arbitrary_send-0.5.1.sol",
"lines": [
12
],
"starting_column": 9,
"ending_column": 47
}
}
]
},
{
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium",
"description": "Test.indirect (tests/arbitrary_send-0.5.1.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/arbitrary_send-0.5.1.sol#20)\n",
"elements": [
{
"type": "function",
"name": "indirect",
"source_mapping": {
"start": 316,
"length": 82,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/arbitrary_send-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_short": "tests/arbitrary_send-0.5.1.sol",
"lines": [
19,
20,
21
],
"starting_column": 5,
"ending_column": 6
}, },
"contract": { {
"type": "contract", "type": "expression",
"name": "Test", "expression": "msg.sender.send(address(this).balance)",
"source_mapping": { "source_mapping": {
"start": 0, "start": 196,
"length": 884, "length": 38,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/arbitrary_send-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_short": "tests/arbitrary_send-0.5.1.sol",
"lines": [
12
],
"starting_column": 9,
"ending_column": 47
}
}
]
},
{
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium",
"description": "Test.indirect (tests/arbitrary_send-0.5.1.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/arbitrary_send-0.5.1.sol#20)\n",
"elements": [
{
"type": "function",
"name": "indirect",
"source_mapping": {
"start": 316,
"length": 82,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/arbitrary_send-0.5.1.sol", "filename_relative": "tests/arbitrary_send-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_short": "tests/arbitrary_send-0.5.1.sol", "filename_short": "tests/arbitrary_send-0.5.1.sol",
"lines": [ "lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19, 19,
20, 20,
21, 21
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 884,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/arbitrary_send-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_short": "tests/arbitrary_send-0.5.1.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "expression",
"expression": "destination.send(address(this).balance)",
"source_mapping": {
"start": 352,
"length": 39,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/arbitrary_send-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_short": "tests/arbitrary_send-0.5.1.sol",
"lines": [
20
],
"starting_column": 9,
"ending_column": 48
} }
} }
}, ]
{ }
"type": "expression", ]
"expression": "destination.send(address(this).balance)", }
"source_mapping": {
"start": 352,
"length": 39,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/arbitrary_send-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol",
"filename_short": "tests/arbitrary_send-0.5.1.sol",
"lines": [
20
],
"starting_column": 9,
"ending_column": 48
}
}
]
}
]

@ -6,4 +6,5 @@ Test.indirect (tests/arbitrary_send-0.5.1.sol#19-21) sends eth to arbitrary user
Dangerous calls: Dangerous calls:
- destination.send(address(this).balance) (tests/arbitrary_send-0.5.1.sol#20) - destination.send(address(this).balance) (tests/arbitrary_send-0.5.1.sol#20)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#functions-that-send-ether-to-arbitrary-destinations Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#functions-that-send-ether-to-arbitrary-destinations
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/arbitrary_send-0.5.1.arbitrary-send.json exists already, the overwrite is prevented
INFO:Slither:tests/arbitrary_send-0.5.1.sol analyzed (1 contracts), 2 result(s) found INFO:Slither:tests/arbitrary_send-0.5.1.sol analyzed (1 contracts), 2 result(s) found

@ -1,204 +1,208 @@
[ {
{ "success": true,
"check": "arbitrary-send", "error": null,
"impact": "High", "results": [
"confidence": "Medium", {
"description": "Test.direct (tests/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/arbitrary_send.sol#12)\n", "check": "arbitrary-send",
"elements": [ "impact": "High",
{ "confidence": "Medium",
"type": "function", "description": "Test.direct (tests/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/arbitrary_send.sol#12)\n",
"name": "direct", "elements": [
"source_mapping": { {
"start": 147, "type": "function",
"length": 79, "name": "direct",
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_relative": "tests/arbitrary_send.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_short": "tests/arbitrary_send.sol",
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Test",
"source_mapping": { "source_mapping": {
"start": 0, "start": 147,
"length": 869, "length": 79,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_relative": "tests/arbitrary_send.sol", "filename_relative": "tests/arbitrary_send.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_short": "tests/arbitrary_send.sol", "filename_short": "tests/arbitrary_send.sol",
"lines": [ "lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11, 11,
12, 12,
13, 13
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 869,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_relative": "tests/arbitrary_send.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_short": "tests/arbitrary_send.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "expression",
"expression": "msg.sender.send(address(this).balance)",
"source_mapping": {
"start": 181,
"length": 38,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_relative": "tests/arbitrary_send.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_short": "tests/arbitrary_send.sol",
"lines": [
12
],
"starting_column": 9,
"ending_column": 47
}
}
]
},
{
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium",
"description": "Test.indirect (tests/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/arbitrary_send.sol#20)\n",
"elements": [
{
"type": "function",
"name": "indirect",
"source_mapping": {
"start": 301,
"length": 82,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_relative": "tests/arbitrary_send.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_short": "tests/arbitrary_send.sol",
"lines": [
19,
20,
21
],
"starting_column": 5,
"ending_column": 6
}, },
"contract": { {
"type": "contract", "type": "expression",
"name": "Test", "expression": "msg.sender.send(address(this).balance)",
"source_mapping": { "source_mapping": {
"start": 0, "start": 181,
"length": 869, "length": 38,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_relative": "tests/arbitrary_send.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_short": "tests/arbitrary_send.sol",
"lines": [
12
],
"starting_column": 9,
"ending_column": 47
}
}
]
},
{
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium",
"description": "Test.indirect (tests/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/arbitrary_send.sol#20)\n",
"elements": [
{
"type": "function",
"name": "indirect",
"source_mapping": {
"start": 301,
"length": 82,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_relative": "tests/arbitrary_send.sol", "filename_relative": "tests/arbitrary_send.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_short": "tests/arbitrary_send.sol", "filename_short": "tests/arbitrary_send.sol",
"lines": [ "lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19, 19,
20, 20,
21, 21
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 869,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_relative": "tests/arbitrary_send.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_short": "tests/arbitrary_send.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "expression",
"expression": "destination.send(address(this).balance)",
"source_mapping": {
"start": 337,
"length": 39,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_relative": "tests/arbitrary_send.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_short": "tests/arbitrary_send.sol",
"lines": [
20
],
"starting_column": 9,
"ending_column": 48
} }
} }
}, ]
{ }
"type": "expression", ]
"expression": "destination.send(address(this).balance)", }
"source_mapping": {
"start": 337,
"length": 39,
"filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_relative": "tests/arbitrary_send.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol",
"filename_short": "tests/arbitrary_send.sol",
"lines": [
20
],
"starting_column": 9,
"ending_column": 48
}
}
]
}
]

@ -6,4 +6,5 @@ Test.indirect (tests/arbitrary_send.sol#19-21) sends eth to arbitrary user
Dangerous calls: Dangerous calls:
- destination.send(address(this).balance) (tests/arbitrary_send.sol#20) - destination.send(address(this).balance) (tests/arbitrary_send.sol#20)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#functions-that-send-ether-to-arbitrary-destinations Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#functions-that-send-ether-to-arbitrary-destinations
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/arbitrary_send.arbitrary-send.json exists already, the overwrite is prevented
INFO:Slither:tests/arbitrary_send.sol analyzed (1 contracts), 2 result(s) found INFO:Slither:tests/arbitrary_send.sol analyzed (1 contracts), 2 result(s) found

@ -1,52 +1,56 @@
[ {
{ "success": true,
"check": "backdoor", "error": null,
"impact": "High", "results": [
"confidence": "High", {
"description": "Backdoor function found in C.i_am_a_backdoor (tests/backdoor.sol#4-6)\n", "check": "backdoor",
"elements": [ "impact": "High",
{ "confidence": "High",
"type": "function", "description": "Backdoor function found in C.i_am_a_backdoor (tests/backdoor.sol#4-6)\n",
"name": "i_am_a_backdoor", "elements": [
"source_mapping": { {
"start": 18, "type": "function",
"length": 74, "name": "i_am_a_backdoor",
"filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_relative": "tests/backdoor.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_short": "tests/backdoor.sol",
"lines": [
4,
5,
6
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "C",
"source_mapping": { "source_mapping": {
"start": 1, "start": 18,
"length": 94, "length": 74,
"filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol", "filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_relative": "tests/backdoor.sol", "filename_relative": "tests/backdoor.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_short": "tests/backdoor.sol", "filename_short": "tests/backdoor.sol",
"lines": [ "lines": [
2,
3,
4, 4,
5, 5,
6, 6
7,
8
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "C",
"source_mapping": {
"start": 1,
"length": 94,
"filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_relative": "tests/backdoor.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_short": "tests/backdoor.sol",
"lines": [
2,
3,
4,
5,
6,
7,
8
],
"starting_column": 1,
"ending_column": 2
}
} }
} }
} ]
] }
} ]
] }

@ -1,5 +1,5 @@
INFO:Detectors: INFO:Detectors:
Backdoor function found in C.i_am_a_backdoor (tests/backdoor.sol#4-6) Backdoor function found in C.i_am_a_backdoor (tests/backdoor.sol#4-6)
Reference: https://github.com/trailofbits/slither/wiki/Adding-a-new-detector Reference: https://github.com/trailofbits/slither/wiki/Adding-a-new-detector
INFO:Slither:/home/monty/Private/tob/tools/slither-public/scripts/../tests/expected_json/backdoor.backdoor.json exists already, the overwrite is prevented INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/backdoor.backdoor.json exists already, the overwrite is prevented
INFO:Slither:tests/backdoor.sol analyzed (1 contracts), 1 result(s) found INFO:Slither:tests/backdoor.sol analyzed (1 contracts), 1 result(s) found

@ -1,52 +1,56 @@
[ {
{ "success": true,
"check": "suicidal", "error": null,
"impact": "High", "results": [
"confidence": "High", {
"description": "C.i_am_a_backdoor (tests/backdoor.sol#4-6) allows anyone to destruct the contract\n", "check": "suicidal",
"elements": [ "impact": "High",
{ "confidence": "High",
"type": "function", "description": "C.i_am_a_backdoor (tests/backdoor.sol#4-6) allows anyone to destruct the contract\n",
"name": "i_am_a_backdoor", "elements": [
"source_mapping": { {
"start": 18, "type": "function",
"length": 74, "name": "i_am_a_backdoor",
"filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_relative": "tests/backdoor.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_short": "tests/backdoor.sol",
"lines": [
4,
5,
6
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "C",
"source_mapping": { "source_mapping": {
"start": 1, "start": 18,
"length": 94, "length": 74,
"filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol", "filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_relative": "tests/backdoor.sol", "filename_relative": "tests/backdoor.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_short": "tests/backdoor.sol", "filename_short": "tests/backdoor.sol",
"lines": [ "lines": [
2,
3,
4, 4,
5, 5,
6, 6
7,
8
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "C",
"source_mapping": {
"start": 1,
"length": 94,
"filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_relative": "tests/backdoor.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol",
"filename_short": "tests/backdoor.sol",
"lines": [
2,
3,
4,
5,
6,
7,
8
],
"starting_column": 1,
"ending_column": 2
}
} }
} }
} ]
] }
} ]
] }

@ -1,5 +1,5 @@
INFO:Detectors: INFO:Detectors:
C.i_am_a_backdoor (tests/backdoor.sol#4-6) allows anyone to destruct the contract C.i_am_a_backdoor (tests/backdoor.sol#4-6) allows anyone to destruct the contract
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#suicidal Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#suicidal
INFO:Slither:/home/monty/Private/tob/tools/slither-public/scripts/../tests/expected_json/backdoor.suicidal.json exists already, the overwrite is prevented INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/backdoor.suicidal.json exists already, the overwrite is prevented
INFO:Slither:tests/backdoor.sol analyzed (1 contracts), 1 result(s) found INFO:Slither:tests/backdoor.sol analyzed (1 contracts), 1 result(s) found

@ -1,112 +1,116 @@
[ {
{ "success": true,
"check": "constable-states", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "A.myFriendsAddress should be constant (tests/const_state_variables.sol#7)\nA.test should be constant (tests/const_state_variables.sol#10)\nA.text2 should be constant (tests/const_state_variables.sol#14)\nB.mySistersAddress should be constant (tests/const_state_variables.sol#26)\nMyConc.should_be_constant should be constant (tests/const_state_variables.sol#42)\nMyConc.should_be_constant_2 should be constant (tests/const_state_variables.sol#43)\n", "check": "constable-states",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "variable", "description": "A.myFriendsAddress should be constant (tests/const_state_variables.sol#7)\nA.test should be constant (tests/const_state_variables.sol#10)\nA.text2 should be constant (tests/const_state_variables.sol#14)\nB.mySistersAddress should be constant (tests/const_state_variables.sol#26)\nMyConc.should_be_constant should be constant (tests/const_state_variables.sol#42)\nMyConc.should_be_constant_2 should be constant (tests/const_state_variables.sol#43)\n",
"name": "myFriendsAddress", "elements": [
"source_mapping": { {
"start": 132, "type": "variable",
"length": 76, "name": "myFriendsAddress",
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", "source_mapping": {
"filename_relative": "tests/const_state_variables.sol", "start": 132,
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", "length": 76,
"filename_short": "tests/const_state_variables.sol", "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"lines": [ "filename_relative": "tests/const_state_variables.sol",
7 "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
], "filename_short": "tests/const_state_variables.sol",
"starting_column": 5, "lines": [
"ending_column": 81 7
],
"starting_column": 5,
"ending_column": 81
}
},
{
"type": "variable",
"name": "mySistersAddress",
"source_mapping": {
"start": 496,
"length": 76,
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_relative": "tests/const_state_variables.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_short": "tests/const_state_variables.sol",
"lines": [
26
],
"starting_column": 5,
"ending_column": 81
}
},
{
"type": "variable",
"name": "should_be_constant",
"source_mapping": {
"start": 793,
"length": 42,
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_relative": "tests/const_state_variables.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_short": "tests/const_state_variables.sol",
"lines": [
42
],
"starting_column": 5,
"ending_column": 47
}
},
{
"type": "variable",
"name": "should_be_constant_2",
"source_mapping": {
"start": 841,
"length": 33,
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_relative": "tests/const_state_variables.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_short": "tests/const_state_variables.sol",
"lines": [
43
],
"starting_column": 5,
"ending_column": 38
}
},
{
"type": "variable",
"name": "test",
"source_mapping": {
"start": 237,
"length": 20,
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_relative": "tests/const_state_variables.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_short": "tests/const_state_variables.sol",
"lines": [
10
],
"starting_column": 5,
"ending_column": 25
}
},
{
"type": "variable",
"name": "text2",
"source_mapping": {
"start": 333,
"length": 20,
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_relative": "tests/const_state_variables.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_short": "tests/const_state_variables.sol",
"lines": [
14
],
"starting_column": 5,
"ending_column": 25
}
} }
}, ]
{ }
"type": "variable", ]
"name": "mySistersAddress", }
"source_mapping": {
"start": 496,
"length": 76,
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_relative": "tests/const_state_variables.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_short": "tests/const_state_variables.sol",
"lines": [
26
],
"starting_column": 5,
"ending_column": 81
}
},
{
"type": "variable",
"name": "should_be_constant",
"source_mapping": {
"start": 793,
"length": 42,
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_relative": "tests/const_state_variables.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_short": "tests/const_state_variables.sol",
"lines": [
42
],
"starting_column": 5,
"ending_column": 47
}
},
{
"type": "variable",
"name": "should_be_constant_2",
"source_mapping": {
"start": 841,
"length": 33,
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_relative": "tests/const_state_variables.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_short": "tests/const_state_variables.sol",
"lines": [
43
],
"starting_column": 5,
"ending_column": 38
}
},
{
"type": "variable",
"name": "test",
"source_mapping": {
"start": 237,
"length": 20,
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_relative": "tests/const_state_variables.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_short": "tests/const_state_variables.sol",
"lines": [
10
],
"starting_column": 5,
"ending_column": 25
}
},
{
"type": "variable",
"name": "text2",
"source_mapping": {
"start": 333,
"length": 20,
"filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_relative": "tests/const_state_variables.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol",
"filename_short": "tests/const_state_variables.sol",
"lines": [
14
],
"starting_column": 5,
"ending_column": 25
}
}
]
}
]

@ -6,4 +6,5 @@ B.mySistersAddress should be constant (tests/const_state_variables.sol#26)
MyConc.should_be_constant should be constant (tests/const_state_variables.sol#42) MyConc.should_be_constant should be constant (tests/const_state_variables.sol#42)
MyConc.should_be_constant_2 should be constant (tests/const_state_variables.sol#43) MyConc.should_be_constant_2 should be constant (tests/const_state_variables.sol#43)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#state-variables-that-could-be-declared-constant Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#state-variables-that-could-be-declared-constant
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/const_state_variables.constable-states.json exists already, the overwrite is prevented
INFO:Slither:tests/const_state_variables.sol analyzed (3 contracts), 1 result(s) found INFO:Slither:tests/const_state_variables.sol analyzed (3 contracts), 1 result(s) found

@ -1,67 +1,71 @@
[ {
{ "success": true,
"check": "constant-function", "error": null,
"impact": "Medium", "results": [
"confidence": "Medium", {
"description": "Constant.test_assembly_bug (tests/constant-0.5.1.sol#15-17) is declared view but contains assembly code\n", "check": "constant-function",
"elements": [ "impact": "Medium",
{ "confidence": "Medium",
"type": "function", "description": "Constant.test_assembly_bug (tests/constant-0.5.1.sol#15-17) is declared view but contains assembly code\n",
"name": "test_assembly_bug", "elements": [
"source_mapping": { {
"start": 185, "type": "function",
"length": 66, "name": "test_assembly_bug",
"filename_used": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol",
"filename_relative": "tests/constant-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol",
"filename_short": "tests/constant-0.5.1.sol",
"lines": [
15,
16,
17
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Constant",
"source_mapping": { "source_mapping": {
"start": 0, "start": 185,
"length": 253, "length": 66,
"filename_used": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol", "filename_used": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol",
"filename_relative": "tests/constant-0.5.1.sol", "filename_relative": "tests/constant-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol",
"filename_short": "tests/constant-0.5.1.sol", "filename_short": "tests/constant-0.5.1.sol",
"lines": [ "lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15, 15,
16, 16,
17, 17
18
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Constant",
"source_mapping": {
"start": 0,
"length": 253,
"filename_used": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol",
"filename_relative": "tests/constant-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol",
"filename_short": "tests/constant-0.5.1.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18
],
"starting_column": 1,
"ending_column": 2
}
} }
},
{
"type": "info",
"contains_assembly": true
} }
}, ]
{ }
"type": "info", ]
"contains_assembly": true }
}
]
}
]

@ -1,4 +1,5 @@
INFO:Detectors: INFO:Detectors:
Constant.test_assembly_bug (tests/constant-0.5.1.sol#15-17) is declared view but contains assembly code Constant.test_assembly_bug (tests/constant-0.5.1.sol#15-17) is declared view but contains assembly code
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/constant-0.5.1.constant-function.json exists already, the overwrite is prevented
INFO:Slither:tests/constant-0.5.1.sol analyzed (1 contracts), 1 result(s) found INFO:Slither:tests/constant-0.5.1.sol analyzed (1 contracts), 1 result(s) found

@ -1,252 +1,256 @@
[ {
{ "success": true,
"check": "constant-function", "error": null,
"impact": "Medium", "results": [
"confidence": "Medium", {
"description": "Constant.test_view_bug (tests/constant.sol#5-7) is declared view but changes state variables:\n\t- Constant.a\n", "check": "constant-function",
"elements": [ "impact": "Medium",
{ "confidence": "Medium",
"type": "function", "description": "Constant.test_view_bug (tests/constant.sol#5-7) is declared view but changes state variables:\n\t- Constant.a\n",
"name": "test_view_bug", "elements": [
"source_mapping": { {
"start": 45, "type": "function",
"length": 58, "name": "test_view_bug",
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"lines": [
5,
6,
7
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Constant",
"source_mapping": { "source_mapping": {
"start": 0, "start": 45,
"length": 392, "length": 58,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol", "filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol", "filename_short": "tests/constant.sol",
"lines": [ "lines": [
1,
2,
3,
4,
5, 5,
6, 6,
7, 7
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Constant",
"source_mapping": {
"start": 0,
"length": 392,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "variable",
"name": "a",
"source_mapping": {
"start": 28,
"length": 6,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"lines": [
3
],
"starting_column": 5,
"ending_column": 11
}
},
{
"type": "info",
"contains_assembly": false
}
]
},
{
"check": "constant-function",
"impact": "Medium",
"confidence": "Medium",
"description": "Constant.test_constant_bug (tests/constant.sol#9-11) is declared view but changes state variables:\n\t- Constant.a\n",
"elements": [
{
"type": "function",
"name": "test_constant_bug",
"source_mapping": {
"start": 113,
"length": 66,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"lines": [
9,
10,
11
],
"starting_column": 5,
"ending_column": 6
}, },
"contract": { {
"type": "contract", "type": "variable",
"name": "Constant", "name": "a",
"source_mapping": { "source_mapping": {
"start": 0, "start": 28,
"length": 392, "length": 6,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol", "filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol", "filename_short": "tests/constant.sol",
"lines": [ "lines": [
1, 3
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 11
} }
}
},
{
"type": "variable",
"name": "a",
"source_mapping": {
"start": 28,
"length": 6,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"lines": [
3
],
"starting_column": 5,
"ending_column": 11
}
},
{
"type": "info",
"contains_assembly": false
}
]
},
{
"check": "constant-function",
"impact": "Medium",
"confidence": "Medium",
"description": "Constant.test_assembly_bug (tests/constant.sol#22-24) is declared view but contains assembly code\n",
"elements": [
{
"type": "function",
"name": "test_assembly_bug",
"source_mapping": {
"start": 324,
"length": 66,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"lines": [
22,
23,
24
],
"starting_column": 5,
"ending_column": 6
}, },
"contract": { {
"type": "contract", "type": "info",
"name": "Constant", "contains_assembly": false
}
]
},
{
"check": "constant-function",
"impact": "Medium",
"confidence": "Medium",
"description": "Constant.test_constant_bug (tests/constant.sol#9-11) is declared view but changes state variables:\n\t- Constant.a\n",
"elements": [
{
"type": "function",
"name": "test_constant_bug",
"source_mapping": { "source_mapping": {
"start": 0, "start": 113,
"length": 392, "length": 66,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol", "filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol", "filename_short": "tests/constant.sol",
"lines": [ "lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9, 9,
10, 10,
11, 11
12, ],
13, "starting_column": 5,
14, "ending_column": 6
15, },
16, "contract": {
17, "type": "contract",
18, "name": "Constant",
19, "source_mapping": {
20, "start": 0,
21, "length": 392,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "variable",
"name": "a",
"source_mapping": {
"start": 28,
"length": 6,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"lines": [
3
],
"starting_column": 5,
"ending_column": 11
}
},
{
"type": "info",
"contains_assembly": false
}
]
},
{
"check": "constant-function",
"impact": "Medium",
"confidence": "Medium",
"description": "Constant.test_assembly_bug (tests/constant.sol#22-24) is declared view but contains assembly code\n",
"elements": [
{
"type": "function",
"name": "test_assembly_bug",
"source_mapping": {
"start": 324,
"length": 66,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"lines": [
22, 22,
23, 23,
24, 24
25
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Constant",
"source_mapping": {
"start": 0,
"length": 392,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
],
"starting_column": 1,
"ending_column": 2
}
} }
},
{
"type": "info",
"contains_assembly": true
} }
}, ]
{ }
"type": "info", ]
"contains_assembly": true }
}
]
}
]

@ -5,4 +5,5 @@ Constant.test_constant_bug (tests/constant.sol#9-11) is declared view but change
- Constant.a - Constant.a
Constant.test_assembly_bug (tests/constant.sol#22-24) is declared view but contains assembly code Constant.test_assembly_bug (tests/constant.sol#22-24) is declared view but contains assembly code
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/constant.constant-function.json exists already, the overwrite is prevented
INFO:Slither:tests/constant.sol analyzed (1 contracts), 3 result(s) found INFO:Slither:tests/constant.sol analyzed (1 contracts), 3 result(s) found

@ -1,173 +1,177 @@
[ {
{ "success": true,
"check": "controlled-delegatecall", "error": null,
"impact": "High", "results": [
"confidence": "Medium", {
"description": "C.bad_delegate_call (tests/controlled_delegatecall.sol#8-11) uses delegatecall to a input-controlled function id\n\taddr_bad.delegatecall(data) (tests/controlled_delegatecall.sol#10)\n", "check": "controlled-delegatecall",
"elements": [ "impact": "High",
{ "confidence": "Medium",
"type": "function", "description": "C.bad_delegate_call (tests/controlled_delegatecall.sol#8-11) uses delegatecall to a input-controlled function id\n\taddr_bad.delegatecall(data) (tests/controlled_delegatecall.sol#10)\n",
"name": "bad_delegate_call", "elements": [
"source_mapping": { {
"start": 101, "type": "function",
"length": 134, "name": "bad_delegate_call",
"filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_relative": "tests/controlled_delegatecall.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_short": "tests/controlled_delegatecall.sol",
"lines": [
8,
9,
10,
11
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "C",
"source_mapping": { "source_mapping": {
"start": 0, "start": 101,
"length": 585, "length": 134,
"filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_relative": "tests/controlled_delegatecall.sol", "filename_relative": "tests/controlled_delegatecall.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_short": "tests/controlled_delegatecall.sol", "filename_short": "tests/controlled_delegatecall.sol",
"lines": [ "lines": [
1,
2,
3,
4,
5,
6,
7,
8, 8,
9, 9,
10, 10,
11, 11
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "C",
"source_mapping": {
"start": 0,
"length": 585,
"filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_relative": "tests/controlled_delegatecall.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_short": "tests/controlled_delegatecall.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "expression",
"expression": "addr_bad.delegatecall(data)",
"source_mapping": {
"start": 201,
"length": 27,
"filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_relative": "tests/controlled_delegatecall.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_short": "tests/controlled_delegatecall.sol",
"lines": [
10
],
"starting_column": 9,
"ending_column": 36
}
}
]
},
{
"check": "controlled-delegatecall",
"impact": "High",
"confidence": "Medium",
"description": "C.bad_delegate_call2 (tests/controlled_delegatecall.sol#18-20) uses delegatecall to a input-controlled function id\n\taddr_bad.delegatecall(abi.encode(func_id,data)) (tests/controlled_delegatecall.sol#19)\n",
"elements": [
{
"type": "function",
"name": "bad_delegate_call2",
"source_mapping": {
"start": 337,
"length": 118,
"filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_relative": "tests/controlled_delegatecall.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_short": "tests/controlled_delegatecall.sol",
"lines": [
18,
19,
20
],
"starting_column": 5,
"ending_column": 6
}, },
"contract": { {
"type": "contract", "type": "expression",
"name": "C", "expression": "addr_bad.delegatecall(data)",
"source_mapping": { "source_mapping": {
"start": 0, "start": 201,
"length": 585, "length": 27,
"filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_relative": "tests/controlled_delegatecall.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_short": "tests/controlled_delegatecall.sol",
"lines": [
10
],
"starting_column": 9,
"ending_column": 36
}
}
]
},
{
"check": "controlled-delegatecall",
"impact": "High",
"confidence": "Medium",
"description": "C.bad_delegate_call2 (tests/controlled_delegatecall.sol#18-20) uses delegatecall to a input-controlled function id\n\taddr_bad.delegatecall(abi.encode(func_id,data)) (tests/controlled_delegatecall.sol#19)\n",
"elements": [
{
"type": "function",
"name": "bad_delegate_call2",
"source_mapping": {
"start": 337,
"length": 118,
"filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_relative": "tests/controlled_delegatecall.sol", "filename_relative": "tests/controlled_delegatecall.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_short": "tests/controlled_delegatecall.sol", "filename_short": "tests/controlled_delegatecall.sol",
"lines": [ "lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18, 18,
19, 19,
20, 20
21,
22,
23,
24,
25
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "C",
"source_mapping": {
"start": 0,
"length": 585,
"filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_relative": "tests/controlled_delegatecall.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_short": "tests/controlled_delegatecall.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "expression",
"expression": "addr_bad.delegatecall(abi.encode(func_id,data))",
"source_mapping": {
"start": 400,
"length": 48,
"filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_relative": "tests/controlled_delegatecall.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_short": "tests/controlled_delegatecall.sol",
"lines": [
19
],
"starting_column": 9,
"ending_column": 57
} }
} }
}, ]
{ }
"type": "expression", ]
"expression": "addr_bad.delegatecall(abi.encode(func_id,data))", }
"source_mapping": {
"start": 400,
"length": 48,
"filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_relative": "tests/controlled_delegatecall.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol",
"filename_short": "tests/controlled_delegatecall.sol",
"lines": [
19
],
"starting_column": 9,
"ending_column": 57
}
}
]
}
]

@ -4,4 +4,5 @@ C.bad_delegate_call (tests/controlled_delegatecall.sol#8-11) uses delegatecall t
C.bad_delegate_call2 (tests/controlled_delegatecall.sol#18-20) uses delegatecall to a input-controlled function id C.bad_delegate_call2 (tests/controlled_delegatecall.sol#18-20) uses delegatecall to a input-controlled function id
addr_bad.delegatecall(abi.encode(func_id,data)) (tests/controlled_delegatecall.sol#19) addr_bad.delegatecall(abi.encode(func_id,data)) (tests/controlled_delegatecall.sol#19)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#controlled-delegatecall Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#controlled-delegatecall
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/controlled_delegatecall.controlled-delegatecall.json exists already, the overwrite is prevented
INFO:Slither:tests/controlled_delegatecall.sol analyzed (1 contracts), 2 result(s) found INFO:Slither:tests/controlled_delegatecall.sol analyzed (1 contracts), 2 result(s) found

@ -1,180 +1,184 @@
[ {
{ "success": true,
"check": "deprecated-standards", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "Deprecated standard detected @ tests/deprecated_calls.sol#2:\n\t- Usage of \"block.blockhash()\" should be replaced with \"blockhash()\"\n", "check": "deprecated-standards",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "variable", "description": "Deprecated standard detected @ tests/deprecated_calls.sol#2:\n\t- Usage of \"block.blockhash()\" should be replaced with \"blockhash()\"\n",
"name": "globalBlockHash", "elements": [
"source_mapping": { {
"start": 48, "type": "variable",
"length": 44, "name": "globalBlockHash",
"filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "source_mapping": {
"filename_relative": "tests/deprecated_calls.sol", "start": 48,
"filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "length": 44,
"filename_short": "tests/deprecated_calls.sol", "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"lines": [ "filename_relative": "tests/deprecated_calls.sol",
2 "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
], "filename_short": "tests/deprecated_calls.sol",
"starting_column": 5, "lines": [
"ending_column": 49 2
],
"starting_column": 5,
"ending_column": 49
}
} }
} ]
] },
}, {
{ "check": "deprecated-standards",
"check": "deprecated-standards", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Deprecated standard detected @ tests/deprecated_calls.sol#7-10:\n\t- Usage of \"msg.gas\" should be replaced with \"gasleft()\"\n",
"description": "Deprecated standard detected @ tests/deprecated_calls.sol#7-10:\n\t- Usage of \"msg.gas\" should be replaced with \"gasleft()\"\n", "elements": [
"elements": [ {
{ "type": "expression",
"type": "expression", "expression": "msg.gas == msg.value",
"expression": "msg.gas == msg.value", "source_mapping": {
"source_mapping": { "start": 258,
"start": 258, "length": 107,
"length": 107, "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_relative": "tests/deprecated_calls.sol",
"filename_relative": "tests/deprecated_calls.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_short": "tests/deprecated_calls.sol",
"filename_short": "tests/deprecated_calls.sol", "lines": [
"lines": [ 7,
7, 8,
8, 9,
9, 10
10 ],
], "starting_column": 9,
"starting_column": 9, "ending_column": 10
"ending_column": 10 }
} }
} ]
] },
}, {
{ "check": "deprecated-standards",
"check": "deprecated-standards", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Deprecated standard detected @ tests/deprecated_calls.sol#9:\n\t- Usage of \"throw\" should be replaced with \"revert()\"\n",
"description": "Deprecated standard detected @ tests/deprecated_calls.sol#9:\n\t- Usage of \"throw\" should be replaced with \"revert()\"\n", "elements": [
"elements": [ {
{ "type": "expression",
"type": "expression", "expression": "None",
"expression": "None", "source_mapping": {
"source_mapping": { "start": 349,
"start": 349, "length": 5,
"length": 5, "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_relative": "tests/deprecated_calls.sol",
"filename_relative": "tests/deprecated_calls.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_short": "tests/deprecated_calls.sol",
"filename_short": "tests/deprecated_calls.sol", "lines": [
"lines": [ 9
9 ],
], "starting_column": 13,
"starting_column": 13, "ending_column": 18
"ending_column": 18 }
} }
} ]
] },
}, {
{ "check": "deprecated-standards",
"check": "deprecated-standards", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Deprecated standard detected @ tests/deprecated_calls.sol#16:\n\t- Usage of \"sha3()\" should be replaced with \"keccak256()\"\n",
"description": "Deprecated standard detected @ tests/deprecated_calls.sol#16:\n\t- Usage of \"sha3()\" should be replaced with \"keccak256()\"\n", "elements": [
"elements": [ {
{ "type": "expression",
"type": "expression", "expression": "sha3Result = sha3()(test deprecated sha3 usage)",
"expression": "sha3Result = sha3()(test deprecated sha3 usage)", "source_mapping": {
"source_mapping": { "start": 542,
"start": 542, "length": 55,
"length": 55, "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_relative": "tests/deprecated_calls.sol",
"filename_relative": "tests/deprecated_calls.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_short": "tests/deprecated_calls.sol",
"filename_short": "tests/deprecated_calls.sol", "lines": [
"lines": [ 16
16 ],
], "starting_column": 9,
"starting_column": 9, "ending_column": 64
"ending_column": 64 }
} }
} ]
] },
}, {
{ "check": "deprecated-standards",
"check": "deprecated-standards", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Deprecated standard detected @ tests/deprecated_calls.sol#19:\n\t- Usage of \"block.blockhash()\" should be replaced with \"blockhash()\"\n",
"description": "Deprecated standard detected @ tests/deprecated_calls.sol#19:\n\t- Usage of \"block.blockhash()\" should be replaced with \"blockhash()\"\n", "elements": [
"elements": [ {
{ "type": "expression",
"type": "expression", "expression": "blockHashResult = block.blockhash(0)",
"expression": "blockHashResult = block.blockhash(0)", "source_mapping": {
"source_mapping": { "start": 671,
"start": 671, "length": 44,
"length": 44, "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_relative": "tests/deprecated_calls.sol",
"filename_relative": "tests/deprecated_calls.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_short": "tests/deprecated_calls.sol",
"filename_short": "tests/deprecated_calls.sol", "lines": [
"lines": [ 19
19 ],
], "starting_column": 9,
"starting_column": 9, "ending_column": 53
"ending_column": 53 }
} }
} ]
] },
}, {
{ "check": "deprecated-standards",
"check": "deprecated-standards", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Deprecated standard detected @ tests/deprecated_calls.sol#22:\n\t- Usage of \"callcode\" should be replaced with \"delegatecall\"\n",
"description": "Deprecated standard detected @ tests/deprecated_calls.sol#22:\n\t- Usage of \"callcode\" should be replaced with \"delegatecall\"\n", "elements": [
"elements": [ {
{ "type": "expression",
"type": "expression", "expression": "address(this).callcode()",
"expression": "address(this).callcode()", "source_mapping": {
"source_mapping": { "start": 785,
"start": 785, "length": 24,
"length": 24, "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_relative": "tests/deprecated_calls.sol",
"filename_relative": "tests/deprecated_calls.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_short": "tests/deprecated_calls.sol",
"filename_short": "tests/deprecated_calls.sol", "lines": [
"lines": [ 22
22 ],
], "starting_column": 9,
"starting_column": 9, "ending_column": 33
"ending_column": 33 }
} }
} ]
] },
}, {
{ "check": "deprecated-standards",
"check": "deprecated-standards", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Deprecated standard detected @ tests/deprecated_calls.sol#25:\n\t- Usage of \"suicide()\" should be replaced with \"selfdestruct()\"\n",
"description": "Deprecated standard detected @ tests/deprecated_calls.sol#25:\n\t- Usage of \"suicide()\" should be replaced with \"selfdestruct()\"\n", "elements": [
"elements": [ {
{ "type": "expression",
"type": "expression", "expression": "suicide(address)(address(0))",
"expression": "suicide(address)(address(0))", "source_mapping": {
"source_mapping": { "start": 878,
"start": 878, "length": 19,
"length": 19, "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_relative": "tests/deprecated_calls.sol",
"filename_relative": "tests/deprecated_calls.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", "filename_short": "tests/deprecated_calls.sol",
"filename_short": "tests/deprecated_calls.sol", "lines": [
"lines": [ 25
25 ],
], "starting_column": 9,
"starting_column": 9, "ending_column": 28
"ending_column": 28 }
} }
} ]
] }
} ]
] }

@ -14,4 +14,5 @@ Deprecated standard detected @ tests/deprecated_calls.sol#22:
Deprecated standard detected @ tests/deprecated_calls.sol#25: Deprecated standard detected @ tests/deprecated_calls.sol#25:
- Usage of "suicide()" should be replaced with "selfdestruct()" - Usage of "suicide()" should be replaced with "selfdestruct()"
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#deprecated-standards Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#deprecated-standards
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/deprecated_calls.deprecated-standards.json exists already, the overwrite is prevented
INFO:Slither:tests/deprecated_calls.sol analyzed (1 contracts), 7 result(s) found INFO:Slither:tests/deprecated_calls.sol analyzed (1 contracts), 7 result(s) found

@ -1,182 +1,186 @@
[ {
{ "success": true,
"check": "erc20-indexed", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "IERC20Bad (tests/erc20_indexed.sol#12-21) does not mark important ERC20 parameters as 'indexed':\n\t-Transfer (tests/erc20_indexed.sol#19) does not index parameter 'from'\n\t-Transfer (tests/erc20_indexed.sol#19) does not index parameter 'to'\n\t-Approval (tests/erc20_indexed.sol#20) does not index parameter 'owner'\n\t-Approval (tests/erc20_indexed.sol#20) does not index parameter 'spender'\n", "check": "erc20-indexed",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "function", "description": "IERC20Bad (tests/erc20_indexed.sol#12-21) does not mark important ERC20 parameters as 'indexed':\n\t-Transfer (tests/erc20_indexed.sol#19) does not index parameter 'from'\n\t-Transfer (tests/erc20_indexed.sol#19) does not index parameter 'to'\n\t-Approval (tests/erc20_indexed.sol#20) does not index parameter 'owner'\n\t-Approval (tests/erc20_indexed.sol#20) does not index parameter 'spender'\n",
"name": "Approval", "elements": [
"source_mapping": { {
"start": 1148, "type": "function",
"length": 59, "name": "Approval",
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol",
"lines": [
20
],
"starting_column": 5,
"ending_column": 64
},
"contract": {
"type": "contract",
"name": "IERC20Bad",
"source_mapping": { "source_mapping": {
"start": 622, "start": 1148,
"length": 587, "length": 59,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol", "filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol", "filename_short": "tests/erc20_indexed.sol",
"lines": [ "lines": [
12, 20
13,
14,
15,
16,
17,
18,
19,
20,
21
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 64
},
"contract": {
"type": "contract",
"name": "IERC20Bad",
"source_mapping": {
"start": 622,
"length": 587,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol",
"lines": [
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "Approval",
"source_mapping": {
"start": 1148,
"length": 59,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol",
"lines": [
20
],
"starting_column": 5,
"ending_column": 64
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "IERC20Bad", "name": "Approval",
"source_mapping": { "source_mapping": {
"start": 622, "start": 1148,
"length": 587, "length": 59,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol", "filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol", "filename_short": "tests/erc20_indexed.sol",
"lines": [ "lines": [
12, 20
13,
14,
15,
16,
17,
18,
19,
20,
21
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 64
},
"contract": {
"type": "contract",
"name": "IERC20Bad",
"source_mapping": {
"start": 622,
"length": 587,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol",
"lines": [
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "Transfer",
"source_mapping": {
"start": 1090,
"length": 53,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol",
"lines": [
19
],
"starting_column": 5,
"ending_column": 58
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "IERC20Bad", "name": "Transfer",
"source_mapping": { "source_mapping": {
"start": 622, "start": 1090,
"length": 587, "length": 53,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol", "filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol", "filename_short": "tests/erc20_indexed.sol",
"lines": [ "lines": [
12, 19
13,
14,
15,
16,
17,
18,
19,
20,
21
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 58
},
"contract": {
"type": "contract",
"name": "IERC20Bad",
"source_mapping": {
"start": 622,
"length": 587,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol",
"lines": [
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "Transfer",
"source_mapping": {
"start": 1090,
"length": 53,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol",
"lines": [
19
],
"starting_column": 5,
"ending_column": 58
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "IERC20Bad", "name": "Transfer",
"source_mapping": { "source_mapping": {
"start": 622, "start": 1090,
"length": 587, "length": 53,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol", "filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol", "filename_short": "tests/erc20_indexed.sol",
"lines": [ "lines": [
12, 19
13,
14,
15,
16,
17,
18,
19,
20,
21
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 58
},
"contract": {
"type": "contract",
"name": "IERC20Bad",
"source_mapping": {
"start": 622,
"length": 587,
"filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_relative": "tests/erc20_indexed.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol",
"filename_short": "tests/erc20_indexed.sol",
"lines": [
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
} }
} }
} ]
] }
} ]
] }

@ -5,4 +5,5 @@ IERC20Bad (tests/erc20_indexed.sol#12-21) does not mark important ERC20 paramete
-Approval (tests/erc20_indexed.sol#20) does not index parameter 'owner' -Approval (tests/erc20_indexed.sol#20) does not index parameter 'owner'
-Approval (tests/erc20_indexed.sol#20) does not index parameter 'spender' -Approval (tests/erc20_indexed.sol#20) does not index parameter 'spender'
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#unindexed-erc20-event-parameters Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#unindexed-erc20-event-parameters
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/erc20_indexed.erc20-indexed.json exists already, the overwrite is prevented
INFO:Slither:tests/erc20_indexed.sol analyzed (3 contracts), 1 result(s) found INFO:Slither:tests/erc20_indexed.sol analyzed (3 contracts), 1 result(s) found

@ -1,231 +1,210 @@
[ {
{ "success": true,
"check": "external-function", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "ContractWithFunctionNotCalled.funcNotCalled3 (tests/external_function.sol#13-15) should be declared external\n", "check": "external-function",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "function", "description": "ContractWithFunctionNotCalled.funcNotCalled3 (tests/external_function.sol#13-15) should be declared external\n",
"name": "funcNotCalled3", "elements": [
"source_mapping": { {
"start": 259, "type": "function",
"length": 41, "name": "funcNotCalled3",
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol",
"lines": [
13,
14,
15
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "ContractWithFunctionNotCalled",
"source_mapping": { "source_mapping": {
"start": 213, "start": 259,
"length": 258, "length": 41,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol", "filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol", "filename_short": "tests/external_function.sol",
"lines": [ "lines": [
11,
12,
13, 13,
14, 14,
15, 15
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "ContractWithFunctionNotCalled",
"source_mapping": {
"start": 213,
"length": 258,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol",
"lines": [
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29
],
"starting_column": 1,
"ending_column": 2
}
} }
} }
} ]
] },
}, {
{ "check": "external-function",
"check": "external-function", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "ContractWithFunctionNotCalled.funcNotCalled2 (tests/external_function.sol#17-19) should be declared external\n",
"description": "ContractWithFunctionNotCalled.funcNotCalled2 (tests/external_function.sol#17-19) should be declared external\n", "elements": [
"elements": [ {
{ "type": "function",
"type": "function", "name": "funcNotCalled2",
"name": "funcNotCalled2",
"source_mapping": {
"start": 306,
"length": 41,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol",
"lines": [
17,
18,
19
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "ContractWithFunctionNotCalled",
"source_mapping": { "source_mapping": {
"start": 213, "start": 306,
"length": 258, "length": 41,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol", "filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol", "filename_short": "tests/external_function.sol",
"lines": [ "lines": [
11,
12,
13,
14,
15,
16,
17, 17,
18, 18,
19, 19
20,
21,
22,
23,
24,
25,
26,
27,
28,
29
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "ContractWithFunctionNotCalled",
"source_mapping": {
"start": 213,
"length": 258,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol",
"lines": [
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29
],
"starting_column": 1,
"ending_column": 2
}
} }
} }
} ]
] },
}, {
{ "check": "external-function",
"check": "external-function", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "ContractWithFunctionNotCalled.funcNotCalled (tests/external_function.sol#21-23) should be declared external\n",
"description": "ContractWithFunctionNotCalled.funcNotCalled (tests/external_function.sol#21-23) should be declared external\n", "elements": [
"elements": [ {
{ "type": "function",
"type": "function", "name": "funcNotCalled",
"name": "funcNotCalled",
"source_mapping": {
"start": 353,
"length": 40,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol",
"lines": [
21,
22,
23
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "ContractWithFunctionNotCalled",
"source_mapping": { "source_mapping": {
"start": 213, "start": 353,
"length": 258, "length": 40,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol", "filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol", "filename_short": "tests/external_function.sol",
"lines": [ "lines": [
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21, 21,
22, 22,
23, 23
24,
25,
26,
27,
28,
29
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "ContractWithFunctionNotCalled",
"source_mapping": {
"start": 213,
"length": 258,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol",
"lines": [
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29
],
"starting_column": 1,
"ending_column": 2
}
} }
} }
} ]
] },
}, {
{ "check": "external-function",
"check": "external-function", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "ContractWithFunctionNotCalled2.funcNotCalled (tests/external_function.sol#32-39) should be declared external\n",
"description": "ContractWithFunctionNotCalled2.funcNotCalled (tests/external_function.sol#32-39) should be declared external\n", "elements": [
"elements": [ {
{ "type": "function",
"type": "function", "name": "funcNotCalled",
"name": "funcNotCalled",
"source_mapping": {
"start": 554,
"length": 325,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol",
"lines": [
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "ContractWithFunctionNotCalled2",
"source_mapping": { "source_mapping": {
"start": 473, "start": 554,
"length": 408, "length": 325,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol", "filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol", "filename_short": "tests/external_function.sol",
"lines": [ "lines": [
31,
32, 32,
33, 33,
34, 34,
@ -233,14 +212,39 @@
36, 36,
37, 37,
38, 38,
39, 39
40
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "ContractWithFunctionNotCalled2",
"source_mapping": {
"start": 473,
"length": 408,
"filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_relative": "tests/external_function.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol",
"filename_short": "tests/external_function.sol",
"lines": [
31,
32,
33,
34,
35,
36,
37,
38,
39,
40
],
"starting_column": 1,
"ending_column": 2
}
} }
} }
} ]
] }
} ]
] }

@ -4,4 +4,5 @@ ContractWithFunctionNotCalled.funcNotCalled2 (tests/external_function.sol#17-19)
ContractWithFunctionNotCalled.funcNotCalled (tests/external_function.sol#21-23) should be declared external ContractWithFunctionNotCalled.funcNotCalled (tests/external_function.sol#21-23) should be declared external
ContractWithFunctionNotCalled2.funcNotCalled (tests/external_function.sol#32-39) should be declared external ContractWithFunctionNotCalled2.funcNotCalled (tests/external_function.sol#32-39) should be declared external
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-as-external Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-as-external
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/external_function.external-function.json exists already, the overwrite is prevented
INFO:Slither:tests/external_function.sol analyzed (5 contracts), 4 result(s) found INFO:Slither:tests/external_function.sol analyzed (5 contracts), 4 result(s) found

@ -1 +1,5 @@
[] {
"success": true,
"error": null,
"results": []
}

@ -1 +1,2 @@
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/external_function_2.external-function.json exists already, the overwrite is prevented
INFO:Slither:tests/external_function_2.sol analyzed (4 contracts), 0 result(s) found INFO:Slither:tests/external_function_2.sol analyzed (4 contracts), 0 result(s) found

@ -74,4 +74,5 @@ TestSolidityKeyword.bad1 (tests/incorrect_equality.sol#127-129) uses a dangerous
TestSolidityKeyword.bad2 (tests/incorrect_equality.sol#131-133) uses a dangerous strict equality: TestSolidityKeyword.bad2 (tests/incorrect_equality.sol#131-133) uses a dangerous strict equality:
- require(bool)(block.number == 0) - require(bool)(block.number == 0)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-strict-equalities Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-strict-equalities
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/incorrect_equality.incorrect-equality.json exists already, the overwrite is prevented
INFO:Slither:tests/incorrect_equality.sol analyzed (5 contracts), 12 result(s) found INFO:Slither:tests/incorrect_equality.sol analyzed (5 contracts), 12 result(s) found

@ -1,256 +1,260 @@
[ {
{ "success": true,
"check": "erc20-interface", "error": null,
"impact": "Medium", "results": [
"confidence": "High", {
"description": "Token (tests/incorrect_erc20_interface.sol#3-10) has incorrect ERC20 function interface(s):\n\t-transfer (tests/incorrect_erc20_interface.sol#4)\n\t-approve (tests/incorrect_erc20_interface.sol#5)\n\t-transferFrom (tests/incorrect_erc20_interface.sol#6)\n\t-totalSupply (tests/incorrect_erc20_interface.sol#7)\n\t-balanceOf (tests/incorrect_erc20_interface.sol#8)\n\t-allowance (tests/incorrect_erc20_interface.sol#9)\n", "check": "erc20-interface",
"elements": [ "impact": "Medium",
{ "confidence": "High",
"type": "function", "description": "Token (tests/incorrect_erc20_interface.sol#3-10) has incorrect ERC20 function interface(s):\n\t-transfer (tests/incorrect_erc20_interface.sol#4)\n\t-approve (tests/incorrect_erc20_interface.sol#5)\n\t-transferFrom (tests/incorrect_erc20_interface.sol#6)\n\t-totalSupply (tests/incorrect_erc20_interface.sol#7)\n\t-balanceOf (tests/incorrect_erc20_interface.sol#8)\n\t-allowance (tests/incorrect_erc20_interface.sol#9)\n",
"name": "allowance", "elements": [
"source_mapping": { {
"start": 319, "type": "function",
"length": 60, "name": "allowance",
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
9
],
"starting_column": 5,
"ending_column": 65
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": { "source_mapping": {
"start": 26, "start": 319,
"length": 355, "length": 60,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [ "lines": [
3, 9
4,
5,
6,
7,
8,
9,
10
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 65
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 26,
"length": 355,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
3,
4,
5,
6,
7,
8,
9,
10
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "approve",
"source_mapping": {
"start": 102,
"length": 55,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
5
],
"starting_column": 5,
"ending_column": 60
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "approve",
"source_mapping": { "source_mapping": {
"start": 26, "start": 102,
"length": 355, "length": 55,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [ "lines": [
3, 5
4,
5,
6,
7,
8,
9,
10
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 60
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 26,
"length": 355,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
3,
4,
5,
6,
7,
8,
9,
10
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "balanceOf",
"source_mapping": {
"start": 273,
"length": 41,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
8
],
"starting_column": 5,
"ending_column": 46
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "balanceOf",
"source_mapping": { "source_mapping": {
"start": 26, "start": 273,
"length": 355, "length": 41,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [ "lines": [
3, 8
4,
5,
6,
7,
8,
9,
10
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 46
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 26,
"length": 355,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
3,
4,
5,
6,
7,
8,
9,
10
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "totalSupply",
"source_mapping": {
"start": 236,
"length": 32,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
7
],
"starting_column": 5,
"ending_column": 37
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "totalSupply",
"source_mapping": { "source_mapping": {
"start": 26, "start": 236,
"length": 355, "length": 32,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [ "lines": [
3, 7
4,
5,
6,
7,
8,
9,
10
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 37
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 26,
"length": 355,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
3,
4,
5,
6,
7,
8,
9,
10
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "transfer",
"source_mapping": {
"start": 46,
"length": 51,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
4
],
"starting_column": 5,
"ending_column": 56
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "transfer",
"source_mapping": { "source_mapping": {
"start": 26, "start": 46,
"length": 355, "length": 51,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [ "lines": [
3, 4
4,
5,
6,
7,
8,
9,
10
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 56
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 26,
"length": 355,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
3,
4,
5,
6,
7,
8,
9,
10
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "transferFrom",
"source_mapping": {
"start": 162,
"length": 69,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
6
],
"starting_column": 5,
"ending_column": 74
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "transferFrom",
"source_mapping": { "source_mapping": {
"start": 26, "start": 162,
"length": 355, "length": 69,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [ "lines": [
3, 6
4,
5,
6,
7,
8,
9,
10
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 74
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 26,
"length": 355,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_relative": "tests/incorrect_erc20_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol",
"filename_short": "tests/incorrect_erc20_interface.sol",
"lines": [
3,
4,
5,
6,
7,
8,
9,
10
],
"starting_column": 1,
"ending_column": 2
}
} }
} }
} ]
] }
} ]
] }

@ -7,4 +7,5 @@ Token (tests/incorrect_erc20_interface.sol#3-10) has incorrect ERC20 function in
-balanceOf (tests/incorrect_erc20_interface.sol#8) -balanceOf (tests/incorrect_erc20_interface.sol#8)
-allowance (tests/incorrect_erc20_interface.sol#9) -allowance (tests/incorrect_erc20_interface.sol#9)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-erc20-interface Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-erc20-interface
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/incorrect_erc20_interface.erc20-interface.json exists already, the overwrite is prevented
INFO:Slither:tests/incorrect_erc20_interface.sol analyzed (1 contracts), 1 result(s) found INFO:Slither:tests/incorrect_erc20_interface.sol analyzed (1 contracts), 1 result(s) found

@ -1,442 +1,446 @@
[ {
{ "success": true,
"check": "erc721-interface", "error": null,
"impact": "Medium", "results": [
"confidence": "High", {
"description": "Token (tests/incorrect_erc721_interface.sol#6-16) has incorrect ERC721 function interface(s):\n\t-supportsInterface (tests/incorrect_erc721_interface.sol#4)\n\t-balanceOf (tests/incorrect_erc721_interface.sol#7)\n\t-ownerOf (tests/incorrect_erc721_interface.sol#8)\n\t-safeTransferFrom (tests/incorrect_erc721_interface.sol#9)\n\t-safeTransferFrom (tests/incorrect_erc721_interface.sol#10)\n\t-transferFrom (tests/incorrect_erc721_interface.sol#11)\n\t-approve (tests/incorrect_erc721_interface.sol#12)\n\t-setApprovalForAll (tests/incorrect_erc721_interface.sol#13)\n\t-getApproved (tests/incorrect_erc721_interface.sol#14)\n\t-isApprovedForAll (tests/incorrect_erc721_interface.sol#15)\n", "check": "erc721-interface",
"elements": [ "impact": "Medium",
{ "confidence": "High",
"type": "function", "description": "Token (tests/incorrect_erc721_interface.sol#6-16) has incorrect ERC721 function interface(s):\n\t-supportsInterface (tests/incorrect_erc721_interface.sol#4)\n\t-balanceOf (tests/incorrect_erc721_interface.sol#7)\n\t-ownerOf (tests/incorrect_erc721_interface.sol#8)\n\t-safeTransferFrom (tests/incorrect_erc721_interface.sol#9)\n\t-safeTransferFrom (tests/incorrect_erc721_interface.sol#10)\n\t-transferFrom (tests/incorrect_erc721_interface.sol#11)\n\t-approve (tests/incorrect_erc721_interface.sol#12)\n\t-setApprovalForAll (tests/incorrect_erc721_interface.sol#13)\n\t-getApproved (tests/incorrect_erc721_interface.sol#14)\n\t-isApprovedForAll (tests/incorrect_erc721_interface.sol#15)\n",
"name": "approve", "elements": [
"source_mapping": { {
"start": 549, "type": "function",
"length": 78, "name": "approve",
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
12
],
"starting_column": 5,
"ending_column": 83
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": { "source_mapping": {
"start": 109, "start": 549,
"length": 739, "length": 78,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [ "lines": [
6, 12
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 83
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 109,
"length": 739,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "balanceOf",
"source_mapping": {
"start": 140,
"length": 44,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
7
],
"starting_column": 5,
"ending_column": 49
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "balanceOf",
"source_mapping": { "source_mapping": {
"start": 109, "start": 140,
"length": 739, "length": 44,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [ "lines": [
6, 7
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 49
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 109,
"length": 739,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "getApproved",
"source_mapping": {
"start": 723,
"length": 48,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
14
],
"starting_column": 5,
"ending_column": 53
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "getApproved",
"source_mapping": { "source_mapping": {
"start": 109, "start": 723,
"length": 739, "length": 48,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [ "lines": [
6, 14
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 53
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 109,
"length": 739,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "isApprovedForAll",
"source_mapping": {
"start": 776,
"length": 70,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
15
],
"starting_column": 5,
"ending_column": 75
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "isApprovedForAll",
"source_mapping": { "source_mapping": {
"start": 109, "start": 776,
"length": 739, "length": 70,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [ "lines": [
6, 15
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 75
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 109,
"length": 739,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "ownerOf",
"source_mapping": {
"start": 189,
"length": 44,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
8
],
"starting_column": 5,
"ending_column": 49
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "ownerOf",
"source_mapping": { "source_mapping": {
"start": 109, "start": 189,
"length": 739, "length": 44,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [ "lines": [
6, 8
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 49
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 109,
"length": 739,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "safeTransferFrom",
"source_mapping": {
"start": 238,
"length": 108,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
9
],
"starting_column": 5,
"ending_column": 113
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "safeTransferFrom",
"source_mapping": { "source_mapping": {
"start": 109, "start": 238,
"length": 739, "length": 108,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [ "lines": [
6, 9
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 113
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 109,
"length": 739,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "safeTransferFrom",
"source_mapping": {
"start": 351,
"length": 96,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
10
],
"starting_column": 5,
"ending_column": 101
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "safeTransferFrom",
"source_mapping": { "source_mapping": {
"start": 109, "start": 351,
"length": 739, "length": 96,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [ "lines": [
6, 10
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 101
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 109,
"length": 739,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "setApprovalForAll",
"source_mapping": {
"start": 632,
"length": 86,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
13
],
"starting_column": 5,
"ending_column": 91
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "setApprovalForAll",
"source_mapping": { "source_mapping": {
"start": 109, "start": 632,
"length": 739, "length": 86,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [ "lines": [
6, 13
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 91
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 109,
"length": 739,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "supportsInterface",
"source_mapping": {
"start": 50,
"length": 56,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
4
],
"starting_column": 5,
"ending_column": 61
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "IERC165", "name": "supportsInterface",
"source_mapping": { "source_mapping": {
"start": 26, "start": 50,
"length": 82, "length": 56,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [ "lines": [
3, 4
4,
5
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 61
},
"contract": {
"type": "contract",
"name": "IERC165",
"source_mapping": {
"start": 26,
"length": 82,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
3,
4,
5
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "function",
"name": "transferFrom",
"source_mapping": {
"start": 452,
"length": 92,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
11
],
"starting_column": 5,
"ending_column": 97
}, },
"contract": { {
"type": "contract", "type": "function",
"name": "Token", "name": "transferFrom",
"source_mapping": { "source_mapping": {
"start": 109, "start": 452,
"length": 739, "length": 92,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [ "lines": [
6, 11
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 97
},
"contract": {
"type": "contract",
"name": "Token",
"source_mapping": {
"start": 109,
"length": 739,
"filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_relative": "tests/incorrect_erc721_interface.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol",
"filename_short": "tests/incorrect_erc721_interface.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16
],
"starting_column": 1,
"ending_column": 2
}
} }
} }
} ]
] }
} ]
] }

@ -11,4 +11,5 @@ Token (tests/incorrect_erc721_interface.sol#6-16) has incorrect ERC721 function
-getApproved (tests/incorrect_erc721_interface.sol#14) -getApproved (tests/incorrect_erc721_interface.sol#14)
-isApprovedForAll (tests/incorrect_erc721_interface.sol#15) -isApprovedForAll (tests/incorrect_erc721_interface.sol#15)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-erc721-interface Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-erc721-interface
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/incorrect_erc721_interface.erc721-interface.json exists already, the overwrite is prevented
INFO:Slither:tests/incorrect_erc721_interface.sol analyzed (2 contracts), 1 result(s) found INFO:Slither:tests/incorrect_erc721_interface.sol analyzed (2 contracts), 1 result(s) found

@ -1,52 +1,24 @@
[ {
{ "success": true,
"check": "assembly", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "GetCode.at uses assembly (tests/inline_assembly_contract-0.5.1.sol#6-20)\n\t- tests/inline_assembly_contract-0.5.1.sol#7-20\n", "check": "assembly",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "function", "description": "GetCode.at uses assembly (tests/inline_assembly_contract-0.5.1.sol#6-20)\n\t- tests/inline_assembly_contract-0.5.1.sol#7-20\n",
"name": "at", "elements": [
"source_mapping": { {
"start": 119, "type": "function",
"length": 707, "name": "at",
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol",
"filename_relative": "tests/inline_assembly_contract-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol",
"filename_short": "tests/inline_assembly_contract-0.5.1.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "GetCode",
"source_mapping": { "source_mapping": {
"start": 97, "start": 119,
"length": 731, "length": 707,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol",
"filename_relative": "tests/inline_assembly_contract-0.5.1.sol", "filename_relative": "tests/inline_assembly_contract-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol",
"filename_short": "tests/inline_assembly_contract-0.5.1.sol", "filename_short": "tests/inline_assembly_contract-0.5.1.sol",
"lines": [ "lines": [
5,
6, 6,
7, 7,
8, 8,
@ -61,44 +33,76 @@
17, 17,
18, 18,
19, 19,
20, 20
21
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "GetCode",
"source_mapping": {
"start": 97,
"length": 731,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol",
"filename_relative": "tests/inline_assembly_contract-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol",
"filename_short": "tests/inline_assembly_contract-0.5.1.sol",
"lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "expression",
"expression": "None",
"source_mapping": {
"start": 198,
"length": 628,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol",
"filename_relative": "tests/inline_assembly_contract-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol",
"filename_short": "tests/inline_assembly_contract-0.5.1.sol",
"lines": [
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
],
"starting_column": 9,
"ending_column": 6
} }
} }
}, ]
{ }
"type": "expression", ]
"expression": "None", }
"source_mapping": {
"start": 198,
"length": 628,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol",
"filename_relative": "tests/inline_assembly_contract-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol",
"filename_short": "tests/inline_assembly_contract-0.5.1.sol",
"lines": [
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
],
"starting_column": 9,
"ending_column": 6
}
}
]
}
]

@ -2,4 +2,5 @@ INFO:Detectors:
GetCode.at uses assembly (tests/inline_assembly_contract-0.5.1.sol#6-20) GetCode.at uses assembly (tests/inline_assembly_contract-0.5.1.sol#6-20)
- tests/inline_assembly_contract-0.5.1.sol#7-20 - tests/inline_assembly_contract-0.5.1.sol#7-20
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/inline_assembly_contract-0.5.1.assembly.json exists already, the overwrite is prevented
INFO:Slither:tests/inline_assembly_contract-0.5.1.sol analyzed (1 contracts), 1 result(s) found INFO:Slither:tests/inline_assembly_contract-0.5.1.sol analyzed (1 contracts), 1 result(s) found

@ -1,52 +1,24 @@
[ {
{ "success": true,
"check": "assembly", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "GetCode.at uses assembly (tests/inline_assembly_contract.sol#6-20)\n\t- tests/inline_assembly_contract.sol#7-20\n", "check": "assembly",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "function", "description": "GetCode.at uses assembly (tests/inline_assembly_contract.sol#6-20)\n\t- tests/inline_assembly_contract.sol#7-20\n",
"name": "at", "elements": [
"source_mapping": { {
"start": 119, "type": "function",
"length": 700, "name": "at",
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol",
"filename_relative": "tests/inline_assembly_contract.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol",
"filename_short": "tests/inline_assembly_contract.sol",
"lines": [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "GetCode",
"source_mapping": { "source_mapping": {
"start": 97, "start": 119,
"length": 724, "length": 700,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol",
"filename_relative": "tests/inline_assembly_contract.sol", "filename_relative": "tests/inline_assembly_contract.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol",
"filename_short": "tests/inline_assembly_contract.sol", "filename_short": "tests/inline_assembly_contract.sol",
"lines": [ "lines": [
5,
6, 6,
7, 7,
8, 8,
@ -61,44 +33,76 @@
17, 17,
18, 18,
19, 19,
20, 20
21
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "GetCode",
"source_mapping": {
"start": 97,
"length": 724,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol",
"filename_relative": "tests/inline_assembly_contract.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol",
"filename_short": "tests/inline_assembly_contract.sol",
"lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "expression",
"expression": "None",
"source_mapping": {
"start": 191,
"length": 628,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol",
"filename_relative": "tests/inline_assembly_contract.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol",
"filename_short": "tests/inline_assembly_contract.sol",
"lines": [
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
],
"starting_column": 9,
"ending_column": 6
} }
} }
}, ]
{ }
"type": "expression", ]
"expression": "None", }
"source_mapping": {
"start": 191,
"length": 628,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol",
"filename_relative": "tests/inline_assembly_contract.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol",
"filename_short": "tests/inline_assembly_contract.sol",
"lines": [
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
],
"starting_column": 9,
"ending_column": 6
}
}
]
}
]

@ -2,4 +2,5 @@ INFO:Detectors:
GetCode.at uses assembly (tests/inline_assembly_contract.sol#6-20) GetCode.at uses assembly (tests/inline_assembly_contract.sol#6-20)
- tests/inline_assembly_contract.sol#7-20 - tests/inline_assembly_contract.sol#7-20
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/inline_assembly_contract.assembly.json exists already, the overwrite is prevented
INFO:Slither:tests/inline_assembly_contract.sol analyzed (1 contracts), 1 result(s) found INFO:Slither:tests/inline_assembly_contract.sol analyzed (1 contracts), 1 result(s) found

@ -1,63 +1,135 @@
[ {
{ "success": true,
"check": "assembly", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "VectorSum.sumAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#16-22)\n\t- tests/inline_assembly_library-0.5.1.sol#18-21\n", "check": "assembly",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "function", "description": "VectorSum.sumAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#16-22)\n\t- tests/inline_assembly_library-0.5.1.sol#18-21\n",
"name": "sumAsm", "elements": [
"source_mapping": { {
"start": 599, "type": "function",
"length": 254, "name": "sumAsm",
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/inline_assembly_library-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/inline_assembly_library-0.5.1.sol",
"lines": [
16,
17,
18,
19,
20,
21,
22
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "VectorSum",
"source_mapping": { "source_mapping": {
"start": 97, "start": 599,
"length": 1602, "length": 254,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/inline_assembly_library-0.5.1.sol", "filename_relative": "tests/inline_assembly_library-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/inline_assembly_library-0.5.1.sol", "filename_short": "tests/inline_assembly_library-0.5.1.sol",
"lines": [ "lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16, 16,
17, 17,
18, 18,
19, 19,
20, 20,
21, 21,
22, 22
23, ],
24, "starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 97,
"length": 1602,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/inline_assembly_library-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/inline_assembly_library-0.5.1.sol",
"lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "expression",
"expression": "None",
"source_mapping": {
"start": 733,
"length": 114,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/inline_assembly_library-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/inline_assembly_library-0.5.1.sol",
"lines": [
18,
19,
20,
21
],
"starting_column": 13,
"ending_column": 10
}
}
]
},
{
"check": "assembly",
"impact": "Informational",
"confidence": "High",
"description": "VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#25-47)\n\t- tests/inline_assembly_library-0.5.1.sol#26-47\n",
"elements": [
{
"type": "function",
"name": "sumPureAsm",
"source_mapping": {
"start": 936,
"length": 761,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/inline_assembly_library-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/inline_assembly_library-0.5.1.sol",
"lines": [
25, 25,
26, 26,
27, 27,
@ -80,112 +152,83 @@
44, 44,
45, 45,
46, 46,
47, 47
48
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 97,
"length": 1602,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/inline_assembly_library-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/inline_assembly_library-0.5.1.sol",
"lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "expression",
"expression": "None",
"source_mapping": {
"start": 733,
"length": 114,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/inline_assembly_library-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/inline_assembly_library-0.5.1.sol",
"lines": [
18,
19,
20,
21
],
"starting_column": 13,
"ending_column": 10
}
}
]
},
{
"check": "assembly",
"impact": "Informational",
"confidence": "High",
"description": "VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#25-47)\n\t- tests/inline_assembly_library-0.5.1.sol#26-47\n",
"elements": [
{
"type": "function",
"name": "sumPureAsm",
"source_mapping": {
"start": 936,
"length": 761,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/inline_assembly_library-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/inline_assembly_library-0.5.1.sol",
"lines": [
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47
],
"starting_column": 5,
"ending_column": 6
}, },
"contract": { {
"type": "contract", "type": "expression",
"name": "VectorSum", "expression": "None",
"source_mapping": { "source_mapping": {
"start": 97, "start": 1020,
"length": 1602, "length": 677,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/inline_assembly_library-0.5.1.sol", "filename_relative": "tests/inline_assembly_library-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/inline_assembly_library-0.5.1.sol", "filename_short": "tests/inline_assembly_library-0.5.1.sol",
"lines": [ "lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26, 26,
27, 27,
28, 28,
@ -207,52 +250,13 @@
44, 44,
45, 45,
46, 46,
47, 47
48
], ],
"starting_column": 1, "starting_column": 9,
"ending_column": 2 "ending_column": 6
} }
} }
}, ]
{ }
"type": "expression", ]
"expression": "None", }
"source_mapping": {
"start": 1020,
"length": 677,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/inline_assembly_library-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/inline_assembly_library-0.5.1.sol",
"lines": [
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47
],
"starting_column": 9,
"ending_column": 6
}
}
]
}
]

@ -4,4 +4,5 @@ VectorSum.sumAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#16-22)
VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#25-47) VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#25-47)
- tests/inline_assembly_library-0.5.1.sol#26-47 - tests/inline_assembly_library-0.5.1.sol#26-47
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/inline_assembly_library-0.5.1.assembly.json exists already, the overwrite is prevented
INFO:Slither:tests/inline_assembly_library-0.5.1.sol analyzed (1 contracts), 2 result(s) found INFO:Slither:tests/inline_assembly_library-0.5.1.sol analyzed (1 contracts), 2 result(s) found

@ -1,63 +1,135 @@
[ {
{ "success": true,
"check": "assembly", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "VectorSum.sumAsm uses assembly (tests/inline_assembly_library.sol#16-22)\n\t- tests/inline_assembly_library.sol#18-21\n", "check": "assembly",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "function", "description": "VectorSum.sumAsm uses assembly (tests/inline_assembly_library.sol#16-22)\n\t- tests/inline_assembly_library.sol#18-21\n",
"name": "sumAsm", "elements": [
"source_mapping": { {
"start": 593, "type": "function",
"length": 247, "name": "sumAsm",
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_relative": "tests/inline_assembly_library.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_short": "tests/inline_assembly_library.sol",
"lines": [
16,
17,
18,
19,
20,
21,
22
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "VectorSum",
"source_mapping": { "source_mapping": {
"start": 98, "start": 593,
"length": 1581, "length": 247,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_relative": "tests/inline_assembly_library.sol", "filename_relative": "tests/inline_assembly_library.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_short": "tests/inline_assembly_library.sol", "filename_short": "tests/inline_assembly_library.sol",
"lines": [ "lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16, 16,
17, 17,
18, 18,
19, 19,
20, 20,
21, 21,
22, 22
23, ],
24, "starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 98,
"length": 1581,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_relative": "tests/inline_assembly_library.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_short": "tests/inline_assembly_library.sol",
"lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "expression",
"expression": "None",
"source_mapping": {
"start": 720,
"length": 114,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_relative": "tests/inline_assembly_library.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_short": "tests/inline_assembly_library.sol",
"lines": [
18,
19,
20,
21
],
"starting_column": 13,
"ending_column": 10
}
}
]
},
{
"check": "assembly",
"impact": "Informational",
"confidence": "High",
"description": "VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library.sol#25-47)\n\t- tests/inline_assembly_library.sol#26-47\n",
"elements": [
{
"type": "function",
"name": "sumPureAsm",
"source_mapping": {
"start": 923,
"length": 754,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_relative": "tests/inline_assembly_library.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_short": "tests/inline_assembly_library.sol",
"lines": [
25, 25,
26, 26,
27, 27,
@ -80,112 +152,83 @@
44, 44,
45, 45,
46, 46,
47, 47
48
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 98,
"length": 1581,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_relative": "tests/inline_assembly_library.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_short": "tests/inline_assembly_library.sol",
"lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "expression",
"expression": "None",
"source_mapping": {
"start": 720,
"length": 114,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_relative": "tests/inline_assembly_library.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_short": "tests/inline_assembly_library.sol",
"lines": [
18,
19,
20,
21
],
"starting_column": 13,
"ending_column": 10
}
}
]
},
{
"check": "assembly",
"impact": "Informational",
"confidence": "High",
"description": "VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library.sol#25-47)\n\t- tests/inline_assembly_library.sol#26-47\n",
"elements": [
{
"type": "function",
"name": "sumPureAsm",
"source_mapping": {
"start": 923,
"length": 754,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_relative": "tests/inline_assembly_library.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_short": "tests/inline_assembly_library.sol",
"lines": [
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47
],
"starting_column": 5,
"ending_column": 6
}, },
"contract": { {
"type": "contract", "type": "expression",
"name": "VectorSum", "expression": "None",
"source_mapping": { "source_mapping": {
"start": 98, "start": 1000,
"length": 1581, "length": 677,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_relative": "tests/inline_assembly_library.sol", "filename_relative": "tests/inline_assembly_library.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_short": "tests/inline_assembly_library.sol", "filename_short": "tests/inline_assembly_library.sol",
"lines": [ "lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26, 26,
27, 27,
28, 28,
@ -207,52 +250,13 @@
44, 44,
45, 45,
46, 46,
47, 47
48
], ],
"starting_column": 1, "starting_column": 9,
"ending_column": 2 "ending_column": 6
} }
} }
}, ]
{ }
"type": "expression", ]
"expression": "None", }
"source_mapping": {
"start": 1000,
"length": 677,
"filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_relative": "tests/inline_assembly_library.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol",
"filename_short": "tests/inline_assembly_library.sol",
"lines": [
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47
],
"starting_column": 9,
"ending_column": 6
}
}
]
}
]

@ -4,4 +4,5 @@ VectorSum.sumAsm uses assembly (tests/inline_assembly_library.sol#16-22)
VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library.sol#25-47) VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library.sol#25-47)
- tests/inline_assembly_library.sol#26-47 - tests/inline_assembly_library.sol#26-47
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#assembly-usage
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/inline_assembly_library.assembly.json exists already, the overwrite is prevented
INFO:Slither:tests/inline_assembly_library.sol analyzed (1 contracts), 2 result(s) found INFO:Slither:tests/inline_assembly_library.sol analyzed (1 contracts), 2 result(s) found

@ -1,69 +1,73 @@
[ {
{ "success": true,
"check": "locked-ether", "error": null,
"impact": "Medium", "results": [
"confidence": "High", {
"description": "Contract locking ether found in :\n\tContract OnlyLocked has payable functions:\n\t - receive (tests/locked_ether-0.5.1.sol#4-6)\n\tBut does not have a function to withdraw the ether\n", "check": "locked-ether",
"elements": [ "impact": "Medium",
{ "confidence": "High",
"type": "function", "description": "Contract locking ether found in :\n\tContract OnlyLocked has payable functions:\n\t - receive (tests/locked_ether-0.5.1.sol#4-6)\n\tBut does not have a function to withdraw the ether\n",
"name": "receive", "elements": [
"source_mapping": { {
"start": 46, "type": "function",
"length": 72, "name": "receive",
"filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol",
"filename_relative": "tests/locked_ether-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol",
"filename_short": "tests/locked_ether-0.5.1.sol",
"lines": [
4,
5,
6
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Locked",
"source_mapping": { "source_mapping": {
"start": 24, "start": 46,
"length": 97, "length": 72,
"filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol",
"filename_relative": "tests/locked_ether-0.5.1.sol", "filename_relative": "tests/locked_ether-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol",
"filename_short": "tests/locked_ether-0.5.1.sol", "filename_short": "tests/locked_ether-0.5.1.sol",
"lines": [ "lines": [
2,
3,
4, 4,
5, 5,
6, 6
7, ],
8 "starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Locked",
"source_mapping": {
"start": 24,
"length": 97,
"filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol",
"filename_relative": "tests/locked_ether-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol",
"filename_short": "tests/locked_ether-0.5.1.sol",
"lines": [
2,
3,
4,
5,
6,
7,
8
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "contract",
"name": "OnlyLocked",
"source_mapping": {
"start": 375,
"length": 32,
"filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol",
"filename_relative": "tests/locked_ether-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol",
"filename_short": "tests/locked_ether-0.5.1.sol",
"lines": [
26
], ],
"starting_column": 1, "starting_column": 1,
"ending_column": 2 "ending_column": 33
} }
} }
}, ]
{ }
"type": "contract", ]
"name": "OnlyLocked", }
"source_mapping": {
"start": 375,
"length": 32,
"filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol",
"filename_relative": "tests/locked_ether-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol",
"filename_short": "tests/locked_ether-0.5.1.sol",
"lines": [
26
],
"starting_column": 1,
"ending_column": 33
}
}
]
}
]

@ -4,4 +4,5 @@ Contract locking ether found in :
- receive (tests/locked_ether-0.5.1.sol#4-6) - receive (tests/locked_ether-0.5.1.sol#4-6)
But does not have a function to withdraw the ether But does not have a function to withdraw the ether
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/locked_ether-0.5.1.locked-ether.json exists already, the overwrite is prevented
INFO:Slither:tests/locked_ether-0.5.1.sol analyzed (4 contracts), 1 result(s) found INFO:Slither:tests/locked_ether-0.5.1.sol analyzed (4 contracts), 1 result(s) found

@ -1,69 +1,73 @@
[ {
{ "success": true,
"check": "locked-ether", "error": null,
"impact": "Medium", "results": [
"confidence": "High", {
"description": "Contract locking ether found in :\n\tContract OnlyLocked has payable functions:\n\t - receive (tests/locked_ether.sol#4-6)\n\tBut does not have a function to withdraw the ether\n", "check": "locked-ether",
"elements": [ "impact": "Medium",
{ "confidence": "High",
"type": "function", "description": "Contract locking ether found in :\n\tContract OnlyLocked has payable functions:\n\t - receive (tests/locked_ether.sol#4-6)\n\tBut does not have a function to withdraw the ether\n",
"name": "receive", "elements": [
"source_mapping": { {
"start": 47, "type": "function",
"length": 72, "name": "receive",
"filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol",
"filename_relative": "tests/locked_ether.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol",
"filename_short": "tests/locked_ether.sol",
"lines": [
4,
5,
6
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Locked",
"source_mapping": { "source_mapping": {
"start": 25, "start": 47,
"length": 97, "length": 72,
"filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol", "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol",
"filename_relative": "tests/locked_ether.sol", "filename_relative": "tests/locked_ether.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol",
"filename_short": "tests/locked_ether.sol", "filename_short": "tests/locked_ether.sol",
"lines": [ "lines": [
2,
3,
4, 4,
5, 5,
6, 6
7, ],
8 "starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Locked",
"source_mapping": {
"start": 25,
"length": 97,
"filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol",
"filename_relative": "tests/locked_ether.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol",
"filename_short": "tests/locked_ether.sol",
"lines": [
2,
3,
4,
5,
6,
7,
8
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "contract",
"name": "OnlyLocked",
"source_mapping": {
"start": 368,
"length": 32,
"filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol",
"filename_relative": "tests/locked_ether.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol",
"filename_short": "tests/locked_ether.sol",
"lines": [
26
], ],
"starting_column": 1, "starting_column": 1,
"ending_column": 2 "ending_column": 33
} }
} }
}, ]
{ }
"type": "contract", ]
"name": "OnlyLocked", }
"source_mapping": {
"start": 368,
"length": 32,
"filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol",
"filename_relative": "tests/locked_ether.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol",
"filename_short": "tests/locked_ether.sol",
"lines": [
26
],
"starting_column": 1,
"ending_column": 33
}
}
]
}
]

@ -4,4 +4,5 @@ Contract locking ether found in :
- receive (tests/locked_ether.sol#4-6) - receive (tests/locked_ether.sol#4-6)
But does not have a function to withdraw the ether But does not have a function to withdraw the ether
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/locked_ether.locked-ether.json exists already, the overwrite is prevented
INFO:Slither:tests/locked_ether.sol analyzed (4 contracts), 1 result(s) found INFO:Slither:tests/locked_ether.sol analyzed (4 contracts), 1 result(s) found

@ -1,67 +1,71 @@
[ {
{ "success": true,
"check": "low-level-calls", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "Low level call in Sender.send (tests/low_level_calls.sol#5-7):\n\t-_receiver.call.value(msg.value).gas(7777)() tests/low_level_calls.sol#6\n", "check": "low-level-calls",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "function", "description": "Low level call in Sender.send (tests/low_level_calls.sol#5-7):\n\t-_receiver.call.value(msg.value).gas(7777)() tests/low_level_calls.sol#6\n",
"name": "send", "elements": [
"source_mapping": { {
"start": 51, "type": "function",
"length": 112, "name": "send",
"filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol",
"filename_relative": "tests/low_level_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol",
"filename_short": "tests/low_level_calls.sol",
"lines": [
5,
6,
7
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Sender",
"source_mapping": { "source_mapping": {
"start": 29, "start": 51,
"length": 136, "length": 112,
"filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", "filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol",
"filename_relative": "tests/low_level_calls.sol", "filename_relative": "tests/low_level_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol",
"filename_short": "tests/low_level_calls.sol", "filename_short": "tests/low_level_calls.sol",
"lines": [ "lines": [
4,
5, 5,
6, 6,
7, 7
8
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Sender",
"source_mapping": {
"start": 29,
"length": 136,
"filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol",
"filename_relative": "tests/low_level_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol",
"filename_short": "tests/low_level_calls.sol",
"lines": [
4,
5,
6,
7,
8
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "expression",
"expression": "_receiver.call.value(msg.value).gas(7777)()",
"source_mapping": {
"start": 111,
"length": 45,
"filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol",
"filename_relative": "tests/low_level_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol",
"filename_short": "tests/low_level_calls.sol",
"lines": [
6
],
"starting_column": 9,
"ending_column": 54
} }
} }
}, ]
{ }
"type": "expression", ]
"expression": "_receiver.call.value(msg.value).gas(7777)()", }
"source_mapping": {
"start": 111,
"length": 45,
"filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol",
"filename_relative": "tests/low_level_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol",
"filename_short": "tests/low_level_calls.sol",
"lines": [
6
],
"starting_column": 9,
"ending_column": 54
}
}
]
}
]

@ -2,4 +2,5 @@ INFO:Detectors:
Low level call in Sender.send (tests/low_level_calls.sol#5-7): Low level call in Sender.send (tests/low_level_calls.sol#5-7):
-_receiver.call.value(msg.value).gas(7777)() tests/low_level_calls.sol#6 -_receiver.call.value(msg.value).gas(7777)() tests/low_level_calls.sol#6
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#low-level-calls Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#low-level-calls
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/low_level_calls.low-level-calls.json exists already, the overwrite is prevented
INFO:Slither:tests/low_level_calls.sol analyzed (2 contracts), 1 result(s) found INFO:Slither:tests/low_level_calls.sol analyzed (2 contracts), 1 result(s) found

@ -1,79 +1,83 @@
[ {
{ "success": true,
"check": "calls-loop", "error": null,
"impact": "Low", "results": [
"confidence": "Medium", {
"description": "CallInLoop.bad has external calls inside a loop:\n\t- destinations[i].transfer(i) (tests/multiple_calls_in_loop.sol#11)\n", "check": "calls-loop",
"elements": [ "impact": "Low",
{ "confidence": "Medium",
"type": "function", "description": "CallInLoop.bad has external calls inside a loop:\n\t- destinations[i].transfer(i) (tests/multiple_calls_in_loop.sol#11)\n",
"name": "bad", "elements": [
"source_mapping": { {
"start": 153, "type": "function",
"length": 135, "name": "bad",
"filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol",
"filename_relative": "tests/multiple_calls_in_loop.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol",
"filename_short": "tests/multiple_calls_in_loop.sol",
"lines": [
9,
10,
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "CallInLoop",
"source_mapping": { "source_mapping": {
"start": 0, "start": 153,
"length": 291, "length": 135,
"filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", "filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol",
"filename_relative": "tests/multiple_calls_in_loop.sol", "filename_relative": "tests/multiple_calls_in_loop.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol",
"filename_short": "tests/multiple_calls_in_loop.sol", "filename_short": "tests/multiple_calls_in_loop.sol",
"lines": [ "lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9, 9,
10, 10,
11, 11,
12, 12,
13, 13
14,
15
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "CallInLoop",
"source_mapping": {
"start": 0,
"length": 291,
"filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol",
"filename_relative": "tests/multiple_calls_in_loop.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol",
"filename_short": "tests/multiple_calls_in_loop.sol",
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "expression",
"expression": "destinations[i].transfer(i)",
"source_mapping": {
"start": 244,
"length": 27,
"filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol",
"filename_relative": "tests/multiple_calls_in_loop.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol",
"filename_short": "tests/multiple_calls_in_loop.sol",
"lines": [
11
],
"starting_column": 13,
"ending_column": 40
} }
} }
}, ]
{ }
"type": "expression", ]
"expression": "destinations[i].transfer(i)", }
"source_mapping": {
"start": 244,
"length": 27,
"filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol",
"filename_relative": "tests/multiple_calls_in_loop.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol",
"filename_short": "tests/multiple_calls_in_loop.sol",
"lines": [
11
],
"starting_column": 13,
"ending_column": 40
}
}
]
}
]

@ -2,4 +2,5 @@ INFO:Detectors:
CallInLoop.bad has external calls inside a loop: CallInLoop.bad has external calls inside a loop:
- destinations[i].transfer(i) (tests/multiple_calls_in_loop.sol#11) - destinations[i].transfer(i) (tests/multiple_calls_in_loop.sol#11)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation/_edit#calls-inside-a-loop Reference: https://github.com/crytic/slither/wiki/Detector-Documentation/_edit#calls-inside-a-loop
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/multiple_calls_in_loop.calls-loop.json exists already, the overwrite is prevented
INFO:Slither:tests/multiple_calls_in_loop.sol analyzed (1 contracts), 1 result(s) found INFO:Slither:tests/multiple_calls_in_loop.sol analyzed (1 contracts), 1 result(s) found

@ -1,366 +1,370 @@
[ {
{ "success": true,
"check": "naming-convention", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "Contract 'naming' (tests/naming_convention.sol#3-48) is not in CapWords\n", "check": "naming-convention",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"target": "contract", "description": "Contract 'naming' (tests/naming_convention.sol#3-48) is not in CapWords\n",
"convention": "CapWords", "elements": [
"name": "naming", {
"source_mapping": { "target": "contract",
"start": 28, "convention": "CapWords",
"length": 642, "name": "naming",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "source_mapping": {
"filename_relative": "tests/naming_convention.sol", "start": 28,
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "length": 642,
"filename_short": "tests/naming_convention.sol", "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"lines": [ "filename_relative": "tests/naming_convention.sol",
3, "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
4, "filename_short": "tests/naming_convention.sol",
5, "lines": [
6, 3,
7, 4,
8, 5,
9, 6,
10, 7,
11, 8,
12, 9,
13, 10,
14, 11,
15, 12,
16, 13,
17, 14,
18, 15,
19, 16,
20, 17,
21, 18,
22, 19,
23, 20,
24, 21,
25, 22,
26, 23,
27, 24,
28, 25,
29, 26,
30, 27,
31, 28,
32, 29,
33, 30,
34, 31,
35, 32,
36, 33,
37, 34,
38, 35,
39, 36,
40, 37,
41, 38,
42, 39,
43, 40,
44, 41,
45, 42,
46, 43,
47, 44,
48 45,
], 46,
"starting_column": 1, 47,
"ending_column": 2 48
],
"starting_column": 1,
"ending_column": 2
}
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Struct 'naming.test' (tests/naming_convention.sol#14-16) is not in CapWords\n",
"description": "Struct 'naming.test' (tests/naming_convention.sol#14-16) is not in CapWords\n", "elements": [
"elements": [ {
{ "target": "structure",
"target": "structure", "convention": "CapWords",
"convention": "CapWords", "name": "test",
"name": "test", "source_mapping": {
"source_mapping": { "start": 229,
"start": 229, "length": 35,
"length": 35, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 14,
14, 15,
15, 16
16 ],
], "starting_column": 5,
"starting_column": 5, "ending_column": 6
"ending_column": 6 }
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Event 'naming.event_' (tests/naming_convention.sol#23) is not in CapWords\n",
"description": "Event 'naming.event_' (tests/naming_convention.sol#23) is not in CapWords\n", "elements": [
"elements": [ {
{ "target": "event",
"target": "event", "convention": "CapWords",
"convention": "CapWords", "name": "event_",
"name": "event_", "source_mapping": {
"source_mapping": { "start": 335,
"start": 335, "length": 19,
"length": 19, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 23
23 ],
], "starting_column": 5,
"starting_column": 5, "ending_column": 24
"ending_column": 24 }
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Function 'naming.GetOne' (tests/naming_convention.sol#30-33) is not in mixedCase\n",
"description": "Function 'naming.GetOne' (tests/naming_convention.sol#30-33) is not in mixedCase\n", "elements": [
"elements": [ {
{ "target": "function",
"target": "function", "convention": "mixedCase",
"convention": "mixedCase", "name": "GetOne",
"name": "GetOne", "source_mapping": {
"source_mapping": { "start": 440,
"start": 440, "length": 75,
"length": 75, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 30,
30, 31,
31, 32,
32, 33
33 ],
], "starting_column": 5,
"starting_column": 5, "ending_column": 6
"ending_column": 6 }
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Parameter 'Number2' of naming.setInt (tests/naming_convention.sol#35) is not in mixedCase\n",
"description": "Parameter 'Number2' of naming.setInt (tests/naming_convention.sol#35) is not in mixedCase\n", "elements": [
"elements": [ {
{ "target": "parameter",
"target": "parameter", "convention": "mixedCase",
"convention": "mixedCase", "name": "Number2",
"name": "Number2", "source_mapping": {
"source_mapping": { "start": 551,
"start": 551, "length": 12,
"length": 12, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 35
35 ],
], "starting_column": 35,
"starting_column": 35, "ending_column": 47
"ending_column": 47 }
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Constant 'naming.MY_other_CONSTANT' (tests/naming_convention.sol#9) is not in UPPER_CASE_WITH_UNDERSCORES\n",
"description": "Constant 'naming.MY_other_CONSTANT' (tests/naming_convention.sol#9) is not in UPPER_CASE_WITH_UNDERSCORES\n", "elements": [
"elements": [ {
{ "target": "variable_constant",
"target": "variable_constant", "convention": "UPPER_CASE_WITH_UNDERSCORES",
"convention": "UPPER_CASE_WITH_UNDERSCORES", "name": "MY_other_CONSTANT",
"name": "MY_other_CONSTANT", "source_mapping": {
"source_mapping": { "start": 143,
"start": 143, "length": 35,
"length": 35, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 9
9 ],
], "starting_column": 5,
"starting_column": 5, "ending_column": 40
"ending_column": 40 }
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Variable 'naming.Var_One' (tests/naming_convention.sol#11) is not in mixedCase\n",
"description": "Variable 'naming.Var_One' (tests/naming_convention.sol#11) is not in mixedCase\n", "elements": [
"elements": [ {
{ "target": "variable",
"target": "variable", "convention": "mixedCase",
"convention": "mixedCase", "name": "Var_One",
"name": "Var_One", "source_mapping": {
"source_mapping": { "start": 185,
"start": 185, "length": 16,
"length": 16, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 11
11 ],
], "starting_column": 5,
"starting_column": 5, "ending_column": 21
"ending_column": 21 }
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Enum 'naming.numbers' (tests/naming_convention.sol#6) is not in CapWords\n",
"description": "Enum 'naming.numbers' (tests/naming_convention.sol#6) is not in CapWords\n", "elements": [
"elements": [ {
{ "target": "enum",
"target": "enum", "convention": "CapWords",
"convention": "CapWords", "name": "numbers",
"name": "numbers", "source_mapping": {
"source_mapping": { "start": 79,
"start": 79, "length": 23,
"length": 23, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 6
6 ],
], "starting_column": 5,
"starting_column": 5, "ending_column": 28
"ending_column": 28 }
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Modifier 'naming.CantDo' (tests/naming_convention.sol#41-43) is not in mixedCase\n",
"description": "Modifier 'naming.CantDo' (tests/naming_convention.sol#41-43) is not in mixedCase\n", "elements": [
"elements": [ {
{ "target": "modifier",
"target": "modifier", "convention": "mixedCase",
"convention": "mixedCase", "name": "CantDo",
"name": "CantDo", "source_mapping": {
"source_mapping": { "start": 591,
"start": 591, "length": 36,
"length": 36, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 41,
41, 42,
42, 43
43 ],
], "starting_column": 5,
"starting_column": 5, "ending_column": 6
"ending_column": 6 }
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Parameter '_used' of T.test (tests/naming_convention.sol#59) is not in mixedCase\n",
"description": "Parameter '_used' of T.test (tests/naming_convention.sol#59) is not in mixedCase\n", "elements": [
"elements": [ {
{ "target": "parameter",
"target": "parameter", "convention": "mixedCase",
"convention": "mixedCase", "name": "_used",
"name": "_used", "source_mapping": {
"source_mapping": { "start": 794,
"start": 794, "length": 10,
"length": 10, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 59
59 ],
], "starting_column": 33,
"starting_column": 33, "ending_column": 43
"ending_column": 43 }
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Variable 'T._myPublicVar' (tests/naming_convention.sol#56) is not in mixedCase\n",
"description": "Variable 'T._myPublicVar' (tests/naming_convention.sol#56) is not in mixedCase\n", "elements": [
"elements": [ {
{ "target": "variable",
"target": "variable", "convention": "mixedCase",
"convention": "mixedCase", "name": "_myPublicVar",
"name": "_myPublicVar", "source_mapping": {
"source_mapping": { "start": 741,
"start": 741, "length": 17,
"length": 17, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 56
56 ],
], "starting_column": 5,
"starting_column": 5, "ending_column": 22
"ending_column": 22 }
} }
} ]
] },
}, {
{ "check": "naming-convention",
"check": "naming-convention", "impact": "Informational",
"impact": "Informational", "confidence": "High",
"confidence": "High", "description": "Variable 'T.l' (tests/naming_convention.sol#67) used l, O, I, which should not be used\n",
"description": "Variable 'T.l' (tests/naming_convention.sol#67) used l, O, I, which should not be used\n", "elements": [
"elements": [ {
{ "target": "variable",
"target": "variable", "convention": "l_O_I_should_not_be_used",
"convention": "l_O_I_should_not_be_used", "name": "l",
"name": "l", "source_mapping": {
"source_mapping": { "start": 900,
"start": 900, "length": 10,
"length": 10, "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_relative": "tests/naming_convention.sol",
"filename_relative": "tests/naming_convention.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", "filename_short": "tests/naming_convention.sol",
"filename_short": "tests/naming_convention.sol", "lines": [
"lines": [ 67
67 ],
], "starting_column": 5,
"starting_column": 5, "ending_column": 15
"ending_column": 15 }
} }
} ]
] }
} ]
] }

@ -12,4 +12,5 @@ Parameter '_used' of T.test (tests/naming_convention.sol#59) is not in mixedCase
Variable 'T._myPublicVar' (tests/naming_convention.sol#56) is not in mixedCase Variable 'T._myPublicVar' (tests/naming_convention.sol#56) is not in mixedCase
Variable 'T.l' (tests/naming_convention.sol#67) used l, O, I, which should not be used Variable 'T.l' (tests/naming_convention.sol#67) used l, O, I, which should not be used
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/naming_convention.naming-convention.json exists already, the overwrite is prevented
INFO:Slither:tests/naming_convention.sol analyzed (3 contracts), 12 result(s) found INFO:Slither:tests/naming_convention.sol analyzed (3 contracts), 12 result(s) found

@ -1,25 +1,29 @@
[ {
{ "success": true,
"check": "solc-version", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "Detected issues with version pragma in tests/old_solc.sol.json:\n\t- pragma solidity0.4.21 (None): it allows old versions\n", "check": "solc-version",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "expression", "description": "Detected issues with version pragma in tests/old_solc.sol.json:\n\t- pragma solidity0.4.21 (None): it allows old versions\n",
"expression": "0.4.21", "elements": [
"source_mapping": { {
"start": 0, "type": "expression",
"length": 23, "expression": "0.4.21",
"filename_used": "old_solc.sol", "source_mapping": {
"filename_relative": null, "start": 0,
"filename_absolute": null, "length": 23,
"filename_short": null, "filename_used": "old_solc.sol",
"lines": [], "filename_relative": null,
"starting_column": null, "filename_absolute": null,
"ending_column": null "filename_short": null,
"lines": [],
"starting_column": null,
"ending_column": null
}
} }
} ]
] }
} ]
] }

@ -2,5 +2,5 @@ INFO:Detectors:
Detected issues with version pragma in tests/old_solc.sol.json: Detected issues with version pragma in tests/old_solc.sol.json:
- pragma solidity0.4.21 (None): it allows old versions - pragma solidity0.4.21 (None): it allows old versions
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-version-of-solidity Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-version-of-solidity
INFO:Slither:/home/monty/Private/tob/tools/slither-public/scripts/../tests/expected_json/old_solc.sol.json.solc-version.json exists already, the overwrite is prevented INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/old_solc.sol.json.solc-version.json exists already, the overwrite is prevented
INFO:Slither:tests/old_solc.sol.json analyzed (1 contracts), 1 result(s) found INFO:Slither:tests/old_solc.sol.json analyzed (1 contracts), 1 result(s) found

@ -1,44 +1,48 @@
[ {
{ "success": true,
"check": "pragma", "error": null,
"impact": "Informational", "results": [
"confidence": "High", {
"description": "Different versions of Solidity is used in :\n\t- Version used: ['^0.4.23', '^0.4.24']\n\t- tests/pragma.0.4.23.sol#1 declares pragma solidity^0.4.23\n\t- tests/pragma.0.4.24.sol#1 declares pragma solidity^0.4.24\n", "check": "pragma",
"elements": [ "impact": "Informational",
{ "confidence": "High",
"type": "expression", "description": "Different versions of Solidity is used in :\n\t- Version used: ['^0.4.23', '^0.4.24']\n\t- tests/pragma.0.4.23.sol#1 declares pragma solidity^0.4.23\n\t- tests/pragma.0.4.24.sol#1 declares pragma solidity^0.4.24\n",
"expression": "^0.4.23", "elements": [
"source_mapping": { {
"start": 0, "type": "expression",
"length": 24, "expression": "^0.4.23",
"filename_used": "/home/travis/build/crytic/slither/tests/pragma.0.4.23.sol", "source_mapping": {
"filename_relative": "tests/pragma.0.4.23.sol", "start": 0,
"filename_absolute": "/home/travis/build/crytic/slither/tests/pragma.0.4.23.sol", "length": 24,
"filename_short": "tests/pragma.0.4.23.sol", "filename_used": "/home/travis/build/crytic/slither/tests/pragma.0.4.23.sol",
"lines": [ "filename_relative": "tests/pragma.0.4.23.sol",
1 "filename_absolute": "/home/travis/build/crytic/slither/tests/pragma.0.4.23.sol",
], "filename_short": "tests/pragma.0.4.23.sol",
"starting_column": 1, "lines": [
"ending_column": 25 1
],
"starting_column": 1,
"ending_column": 25
}
},
{
"type": "expression",
"expression": "^0.4.24",
"source_mapping": {
"start": 0,
"length": 24,
"filename_used": "/home/travis/build/crytic/slither/tests/pragma.0.4.24.sol",
"filename_relative": "tests/pragma.0.4.24.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/pragma.0.4.24.sol",
"filename_short": "tests/pragma.0.4.24.sol",
"lines": [
1
],
"starting_column": 1,
"ending_column": 25
}
} }
}, ]
{ }
"type": "expression", ]
"expression": "^0.4.24", }
"source_mapping": {
"start": 0,
"length": 24,
"filename_used": "/home/travis/build/crytic/slither/tests/pragma.0.4.24.sol",
"filename_relative": "tests/pragma.0.4.24.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/pragma.0.4.24.sol",
"filename_short": "tests/pragma.0.4.24.sol",
"lines": [
1
],
"starting_column": 1,
"ending_column": 25
}
}
]
}
]

@ -1,8 +1,8 @@
ERROR:Slither:Invalid compilation INFO:Detectors:
ERROR:Slither:Invalid solc compilation tests/pragma.0.4.23.sol:1:1: Error: Source file requires different compiler version (current compiler is 0.5.1+commit.c8a2cb62.Linux.g++ - note that nightly builds are considered to be strictly less than the released version Different versions of Solidity is used in :
pragma solidity ^0.4.23; - Version used: ['^0.4.23', '^0.4.24']
^----------------------^ - tests/pragma.0.4.23.sol#1 declares pragma solidity^0.4.23
tests/pragma.0.4.24.sol:1:1: Error: Source file requires different compiler version (current compiler is 0.5.1+commit.c8a2cb62.Linux.g++ - note that nightly builds are considered to be strictly less than the released version - tests/pragma.0.4.24.sol#1 declares pragma solidity^0.4.24
pragma solidity ^0.4.24; Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#different-pragma-directives-are-used
^----------------------^ INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/pragma.0.4.24.pragma.json exists already, the overwrite is prevented
INFO:Slither:tests/pragma.0.4.24.sol analyzed (1 contracts), 1 result(s) found

@ -1,56 +1,24 @@
[ {
{ "success": true,
"check": "reentrancy-eth", "error": null,
"impact": "High", "results": [
"confidence": "Medium", {
"description": "Reentrancy in Reentrancy.withdrawBalance (tests/reentrancy-0.5.1.sol#14-22):\n\tExternal calls:\n\t- (ret,mem) = msg.sender.call.value(userBalance[msg.sender])() (tests/reentrancy-0.5.1.sol#17)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy-0.5.1.sol#21)\n", "check": "reentrancy-eth",
"elements": [ "impact": "High",
{ "confidence": "Medium",
"type": "function", "description": "Reentrancy in Reentrancy.withdrawBalance (tests/reentrancy-0.5.1.sol#14-22):\n\tExternal calls:\n\t- (ret,mem) = msg.sender.call.value(userBalance[msg.sender])() (tests/reentrancy-0.5.1.sol#17)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy-0.5.1.sol#21)\n",
"name": "withdrawBalance", "elements": [
"source_mapping": { {
"start": 298, "type": "function",
"length": 357, "name": "withdrawBalance",
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
14,
15,
16,
17,
18,
19,
20,
21,
22
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Reentrancy",
"source_mapping": { "source_mapping": {
"start": 25, "start": 298,
"length": 1807, "length": 357,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol", "filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol", "filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [ "lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14, 14,
15, 15,
16, 16,
@ -59,165 +27,134 @@
19, 19,
20, 20,
21, 21,
22, 22
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Reentrancy",
"source_mapping": {
"start": 25,
"length": 1807,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "external_calls",
"expression": "(ret,mem) = msg.sender.call.value(userBalance[msg.sender])()",
"source_mapping": {
"start": 477,
"length": 81,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
17
],
"starting_column": 9,
"ending_column": 90
}
},
{
"type": "variables_written",
"name": "userBalance",
"expression": "userBalance[msg.sender] = 0",
"source_mapping": {
"start": 621,
"length": 27,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
21
],
"starting_column": 9,
"ending_column": 36
}
}
]
},
{
"check": "reentrancy-eth",
"impact": "High",
"confidence": "Medium",
"description": "Reentrancy in Reentrancy.withdrawBalance_fixed_3 (tests/reentrancy-0.5.1.sol#44-53):\n\tExternal calls:\n\t- (ret,mem) = msg.sender.call.value(amount)() (tests/reentrancy-0.5.1.sol#49)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy-0.5.1.sol#51)\n",
"elements": [
{
"type": "function",
"name": "withdrawBalance_fixed_3",
"source_mapping": {
"start": 1434,
"length": 393,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
44,
45,
46,
47,
48,
49,
50,
51,
52,
53
],
"starting_column": 5,
"ending_column": 6
}, },
"contract": { {
"type": "contract", "type": "external_calls",
"name": "Reentrancy", "expression": "(ret,mem) = msg.sender.call.value(userBalance[msg.sender])()",
"source_mapping": { "source_mapping": {
"start": 25, "start": 477,
"length": 1807, "length": 81,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
17
],
"starting_column": 9,
"ending_column": 90
}
},
{
"type": "variables_written",
"name": "userBalance",
"expression": "userBalance[msg.sender] = 0",
"source_mapping": {
"start": 621,
"length": 27,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
21
],
"starting_column": 9,
"ending_column": 36
}
}
]
},
{
"check": "reentrancy-eth",
"impact": "High",
"confidence": "Medium",
"description": "Reentrancy in Reentrancy.withdrawBalance_fixed_3 (tests/reentrancy-0.5.1.sol#44-53):\n\tExternal calls:\n\t- (ret,mem) = msg.sender.call.value(amount)() (tests/reentrancy-0.5.1.sol#49)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy-0.5.1.sol#51)\n",
"elements": [
{
"type": "function",
"name": "withdrawBalance_fixed_3",
"source_mapping": {
"start": 1434,
"length": 393,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol", "filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol", "filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [ "lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44, 44,
45, 45,
46, 46,
@ -227,49 +164,116 @@
50, 50,
51, 51,
52, 52,
53, 53
54
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Reentrancy",
"source_mapping": {
"start": 25,
"length": 1807,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "external_calls",
"expression": "(ret,mem) = msg.sender.call.value(amount)()",
"source_mapping": {
"start": 1679,
"length": 64,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
49
],
"starting_column": 9,
"ending_column": 73
}
},
{
"type": "variables_written",
"name": "userBalance",
"expression": "userBalance[msg.sender] = amount",
"source_mapping": {
"start": 1778,
"length": 32,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
51
],
"starting_column": 13,
"ending_column": 45
} }
} }
}, ]
{ }
"type": "external_calls", ]
"expression": "(ret,mem) = msg.sender.call.value(amount)()", }
"source_mapping": {
"start": 1679,
"length": 64,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
49
],
"starting_column": 9,
"ending_column": 73
}
},
{
"type": "variables_written",
"name": "userBalance",
"expression": "userBalance[msg.sender] = amount",
"source_mapping": {
"start": 1778,
"length": 32,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_relative": "tests/reentrancy-0.5.1.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol",
"filename_short": "tests/reentrancy-0.5.1.sol",
"lines": [
51
],
"starting_column": 13,
"ending_column": 45
}
}
]
}
]

@ -10,4 +10,5 @@ Reentrancy in Reentrancy.withdrawBalance_fixed_3 (tests/reentrancy-0.5.1.sol#44-
State variables written after the call(s): State variables written after the call(s):
- userBalance (tests/reentrancy-0.5.1.sol#51) - userBalance (tests/reentrancy-0.5.1.sol#51)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities
INFO:Slither:/home/travis/build/crytic/slither/scripts/../tests/expected_json/reentrancy-0.5.1.reentrancy-eth.json exists already, the overwrite is prevented
INFO:Slither:tests/reentrancy-0.5.1.sol analyzed (1 contracts), 2 result(s) found INFO:Slither:tests/reentrancy-0.5.1.sol analyzed (1 contracts), 2 result(s) found

@ -1,10 +0,0 @@
Traceback (most recent call last):
File "/home/monty/Envs/slither/bin/slither", line 11, in <module>
load_entry_point('slither-analyzer', 'console_scripts', 'slither')()
File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 469, in main
main_impl(all_detector_classes=detectors, all_printer_classes=printers)
File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 483, in main_impl
detector_classes = choose_detectors(args, all_detector_classes)
File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 176, in choose_detectors
raise Exception('Error: {} is not a detector'.format(d))
Exception: Error: reentrancy is not a detector

@ -1,55 +1,24 @@
[ {
{ "success": true,
"check": "reentrancy-eth", "error": null,
"impact": "High", "results": [
"confidence": "Medium", {
"description": "Reentrancy in Reentrancy.withdrawBalance (tests/reentrancy.sol#14-21):\n\tExternal calls:\n\t- ! (msg.sender.call.value(userBalance[msg.sender])()) (tests/reentrancy.sol#17-19)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy.sol#20)\n", "check": "reentrancy-eth",
"elements": [ "impact": "High",
{ "confidence": "Medium",
"type": "function", "description": "Reentrancy in Reentrancy.withdrawBalance (tests/reentrancy.sol#14-21):\n\tExternal calls:\n\t- ! (msg.sender.call.value(userBalance[msg.sender])()) (tests/reentrancy.sol#17-19)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy.sol#20)\n",
"name": "withdrawBalance", "elements": [
"source_mapping": { {
"start": 299, "type": "function",
"length": 314, "name": "withdrawBalance",
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol",
"lines": [
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 5,
"ending_column": 6
},
"contract": {
"type": "contract",
"name": "Reentrancy",
"source_mapping": { "source_mapping": {
"start": 26, "start": 299,
"length": 2334, "length": 314,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol", "filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol", "filename_short": "tests/reentrancy.sol",
"lines": [ "lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14, 14,
15, 15,
16, 16,
@ -57,253 +26,288 @@
18, 18,
19, 19,
20, 20,
21, 21
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Reentrancy",
"source_mapping": {
"start": 26,
"length": 2334,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol",
"lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72
],
"starting_column": 1,
"ending_column": 2
}
} }
}
},
{
"type": "external_calls",
"expression": "! (msg.sender.call.value(userBalance[msg.sender])())",
"source_mapping": {
"start": 478,
"length": 92,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol",
"lines": [
17,
18,
19
],
"starting_column": 9,
"ending_column": 10
}
},
{
"type": "variables_written",
"name": "userBalance",
"expression": "userBalance[msg.sender] = 0",
"source_mapping": {
"start": 579,
"length": 27,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol",
"lines": [
20
],
"starting_column": 9,
"ending_column": 36
}
}
]
},
{
"check": "reentrancy-eth",
"impact": "High",
"confidence": "Medium",
"description": "Reentrancy in Reentrancy.withdrawBalance_nested (tests/reentrancy.sol#64-70):\n\tExternal calls:\n\t- msg.sender.call.value(amount / 2)() (tests/reentrancy.sol#67)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy.sol#68)\n",
"elements": [
{
"type": "function",
"name": "withdrawBalance_nested",
"source_mapping": {
"start": 2108,
"length": 246,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol",
"lines": [
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 5,
"ending_column": 6
}, },
"contract": { {
"type": "contract", "type": "external_calls",
"name": "Reentrancy", "expression": "! (msg.sender.call.value(userBalance[msg.sender])())",
"source_mapping": { "source_mapping": {
"start": 26, "start": 478,
"length": 2334, "length": 92,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol", "filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol", "filename_short": "tests/reentrancy.sol",
"lines": [ "lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17, 17,
18, 18,
19, 19
20, ],
21, "starting_column": 9,
22, "ending_column": 10
23, }
24, },
25, {
26, "type": "variables_written",
27, "name": "userBalance",
28, "expression": "userBalance[msg.sender] = 0",
29, "source_mapping": {
30, "start": 579,
31, "length": 27,
32, "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
33, "filename_relative": "tests/reentrancy.sol",
34, "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
35, "filename_short": "tests/reentrancy.sol",
36, "lines": [
37, 20
38, ],
39, "starting_column": 9,
40, "ending_column": 36
41, }
42, }
43, ]
44, },
45, {
46, "check": "reentrancy-eth",
47, "impact": "High",
48, "confidence": "Medium",
49, "description": "Reentrancy in Reentrancy.withdrawBalance_nested (tests/reentrancy.sol#64-70):\n\tExternal calls:\n\t- msg.sender.call.value(amount / 2)() (tests/reentrancy.sol#67)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy.sol#68)\n",
50, "elements": [
51, {
52, "type": "function",
53, "name": "withdrawBalance_nested",
54, "source_mapping": {
55, "start": 2108,
56, "length": 246,
57, "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
58, "filename_relative": "tests/reentrancy.sol",
59, "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
60, "filename_short": "tests/reentrancy.sol",
61, "lines": [
62,
63,
64, 64,
65, 65,
66, 66,
67, 67,
68, 68,
69, 69,
70, 70
71,
72
], ],
"starting_column": 1, "starting_column": 5,
"ending_column": 2 "ending_column": 6
},
"contract": {
"type": "contract",
"name": "Reentrancy",
"source_mapping": {
"start": 26,
"length": 2334,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol",
"lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72
],
"starting_column": 1,
"ending_column": 2
}
}
},
{
"type": "external_calls",
"expression": "msg.sender.call.value(amount / 2)()",
"source_mapping": {
"start": 2263,
"length": 33,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol",
"lines": [
67
],
"starting_column": 13,
"ending_column": 46
}
},
{
"type": "variables_written",
"name": "userBalance",
"expression": "userBalance[msg.sender] = 0",
"source_mapping": {
"start": 2310,
"length": 27,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol",
"lines": [
68
],
"starting_column": 13,
"ending_column": 40
} }
} }
}, ]
{ }
"type": "external_calls", ]
"expression": "msg.sender.call.value(amount / 2)()", }
"source_mapping": {
"start": 2263,
"length": 33,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol",
"lines": [
67
],
"starting_column": 13,
"ending_column": 46
}
},
{
"type": "variables_written",
"name": "userBalance",
"expression": "userBalance[msg.sender] = 0",
"source_mapping": {
"start": 2310,
"length": 27,
"filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_relative": "tests/reentrancy.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol",
"filename_short": "tests/reentrancy.sol",
"lines": [
68
],
"starting_column": 13,
"ending_column": 40
}
}
]
}
]

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save