Merge pull request #825 from crytic/restructure-test-folder

Restructure test folder
pull/830/head^2
Feist Josselin 4 years ago committed by GitHub
commit eabdd9e78e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol
  2. 396
      tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol.0.4.25.ABIEncoderV2Array.json
  3. 99
      tests/detectors/abiencoderv2-array/0.5.10/storage_ABIEncoderV2_array.sol
  4. 1834
      tests/detectors/abiencoderv2-array/0.5.10/storage_ABIEncoderV2_array.sol.0.5.10.ABIEncoderV2Array.json
  5. 99
      tests/detectors/abiencoderv2-array/0.5.11/storage_ABIEncoderV2_array.sol
  6. 0
      tests/detectors/abiencoderv2-array/0.5.11/storage_ABIEncoderV2_array.sol.0.5.11.ABIEncoderV2Array.json
  7. 0
      tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol
  8. 56
      tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol.0.4.25.ArbitrarySend.json
  9. 0
      tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol
  10. 390
      tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol.0.5.16.ArbitrarySend.json
  11. 41
      tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol
  12. 390
      tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol.0.6.11.ArbitrarySend.json
  13. 41
      tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol
  14. 56
      tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol.0.7.6.ArbitrarySend.json
  15. 0
      tests/detectors/array-by-reference/0.4.25/array_by_reference.sol
  16. 188
      tests/detectors/array-by-reference/0.4.25/array_by_reference.sol.0.4.25.ArrayByReference.json
  17. 51
      tests/detectors/array-by-reference/0.5.16/array_by_reference.sol
  18. 1339
      tests/detectors/array-by-reference/0.5.16/array_by_reference.sol.0.5.16.ArrayByReference.json
  19. 51
      tests/detectors/array-by-reference/0.6.11/array_by_reference.sol
  20. 1339
      tests/detectors/array-by-reference/0.6.11/array_by_reference.sol.0.6.11.ArrayByReference.json
  21. 51
      tests/detectors/array-by-reference/0.7.6/array_by_reference.sol
  22. 1339
      tests/detectors/array-by-reference/0.7.6/array_by_reference.sol.0.7.6.ArrayByReference.json
  23. 0
      tests/detectors/assembly/0.4.25/inline_assembly_contract.sol
  24. 28
      tests/detectors/assembly/0.4.25/inline_assembly_contract.sol.0.4.25.Assembly.json
  25. 0
      tests/detectors/assembly/0.4.25/inline_assembly_library.sol
  26. 56
      tests/detectors/assembly/0.4.25/inline_assembly_library.sol.0.4.25.Assembly.json
  27. 0
      tests/detectors/assembly/0.5.16/inline_assembly_contract.sol
  28. 35
      tests/detectors/assembly/0.5.16/inline_assembly_contract.sol.0.5.16.Assembly.json
  29. 0
      tests/detectors/assembly/0.5.16/inline_assembly_library.sol
  30. 70
      tests/detectors/assembly/0.5.16/inline_assembly_library.sol.0.5.16.Assembly.json
  31. 20
      tests/detectors/assembly/0.6.11/inline_assembly_contract.sol
  32. 185
      tests/detectors/assembly/0.6.11/inline_assembly_contract.sol.0.6.11.Assembly.json
  33. 47
      tests/detectors/assembly/0.6.11/inline_assembly_library.sol
  34. 472
      tests/detectors/assembly/0.6.11/inline_assembly_library.sol.0.6.11.Assembly.json
  35. 20
      tests/detectors/assembly/0.7.6/inline_assembly_contract.sol
  36. 185
      tests/detectors/assembly/0.7.6/inline_assembly_contract.sol.0.7.6.Assembly.json
  37. 47
      tests/detectors/assembly/0.7.6/inline_assembly_library.sol
  38. 472
      tests/detectors/assembly/0.7.6/inline_assembly_library.sol.0.7.6.Assembly.json
  39. 0
      tests/detectors/assert-state-change/0.4.25/assert_state_change.sol
  40. 571
      tests/detectors/assert-state-change/0.4.25/assert_state_change.sol.0.4.25.AssertStateChange.json
  41. 39
      tests/detectors/assert-state-change/0.5.16/assert_state_change.sol
  42. 571
      tests/detectors/assert-state-change/0.5.16/assert_state_change.sol.0.5.16.AssertStateChange.json
  43. 39
      tests/detectors/assert-state-change/0.6.11/assert_state_change.sol
  44. 571
      tests/detectors/assert-state-change/0.6.11/assert_state_change.sol.0.6.11.AssertStateChange.json
  45. 39
      tests/detectors/assert-state-change/0.7.6/assert_state_change.sol
  46. 84
      tests/detectors/assert-state-change/0.7.6/assert_state_change.sol.0.7.6.AssertStateChange.json
  47. 0
      tests/detectors/backdoor/0.4.25/backdoor.sol
  48. 14
      tests/detectors/backdoor/0.4.25/backdoor.sol.0.4.25.Backdoor.json
  49. 8
      tests/detectors/backdoor/0.5.16/backdoor.sol
  50. 18
      tests/detectors/backdoor/0.5.16/backdoor.sol.0.5.16.Backdoor.json
  51. 8
      tests/detectors/backdoor/0.6.11/backdoor.sol
  52. 18
      tests/detectors/backdoor/0.6.11/backdoor.sol.0.6.11.Backdoor.json
  53. 8
      tests/detectors/backdoor/0.7.6/backdoor.sol
  54. 14
      tests/detectors/backdoor/0.7.6/backdoor.sol.0.7.6.Backdoor.json
  55. 0
      tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol
  56. 28
      tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol.0.4.25.BooleanConstantMisuse.json
  57. 46
      tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol
  58. 170
      tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol.0.5.16.BooleanConstantMisuse.json
  59. 46
      tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol
  60. 209
      tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol.0.6.11.BooleanConstantMisuse.json
  61. 46
      tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol
  62. 209
      tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol.0.7.6.BooleanConstantMisuse.json
  63. 0
      tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol
  64. 28
      tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol.0.4.25.BooleanEquality.json
  65. 27
      tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol
  66. 171
      tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol.0.5.16.BooleanEquality.json
  67. 27
      tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol
  68. 171
      tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol.0.6.11.BooleanEquality.json
  69. 27
      tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol
  70. 57
      tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol.0.7.6.BooleanEquality.json
  71. 0
      tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol
  72. 28
      tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol.0.4.25.MultipleCallsInLoop.json
  73. 15
      tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol
  74. 149
      tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol.0.5.16.MultipleCallsInLoop.json
  75. 15
      tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol
  76. 149
      tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol.0.6.11.MultipleCallsInLoop.json
  77. 15
      tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol
  78. 149
      tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol.0.7.6.MultipleCallsInLoop.json
  79. 0
      tests/detectors/constable-states/0.4.25/const_state_variables.sol
  80. 84
      tests/detectors/constable-states/0.4.25/const_state_variables.sol.0.4.25.ConstCandidateStateVars.json
  81. 52
      tests/detectors/constable-states/0.5.16/const_state_variables.sol
  82. 388
      tests/detectors/constable-states/0.5.16/const_state_variables.sol.0.5.16.ConstCandidateStateVars.json
  83. 52
      tests/detectors/constable-states/0.6.11/const_state_variables.sol
  84. 388
      tests/detectors/constable-states/0.6.11/const_state_variables.sol.0.6.11.ConstCandidateStateVars.json
  85. 52
      tests/detectors/constable-states/0.7.6/const_state_variables.sol
  86. 84
      tests/detectors/constable-states/0.7.6/const_state_variables.sol.0.7.6.ConstCandidateStateVars.json
  87. 0
      tests/detectors/constant-function-asm/0.4.25/constant.sol
  88. 14
      tests/detectors/constant-function-asm/0.4.25/constant.sol.0.4.25.ConstantFunctionsAsm.json
  89. 2
      tests/detectors/constant-function-asm/0.5.16/constant.sol
  90. 0
      tests/detectors/constant-function-asm/0.5.16/constant.sol.0.5.16.ConstantFunctionsAsm.json
  91. 20
      tests/detectors/constant-function-asm/0.6.11/constant.sol
  92. 0
      tests/detectors/constant-function-asm/0.6.11/constant.sol.0.6.11.ConstantFunctionsAsm.json
  93. 20
      tests/detectors/constant-function-asm/0.7.6/constant.sol
  94. 0
      tests/detectors/constant-function-asm/0.7.6/constant.sol.0.7.6.ConstantFunctionsAsm.json
  95. 25
      tests/detectors/constant-function-state/0.4.25/constant.sol
  96. 44
      tests/detectors/constant-function-state/0.4.25/constant.sol.0.4.25.ConstantFunctionsState.json
  97. 20
      tests/detectors/constant-function-state/0.5.16/constant.sol
  98. 0
      tests/detectors/constant-function-state/0.5.16/constant.sol.0.5.16.ConstantFunctionsState.json
  99. 20
      tests/detectors/constant-function-state/0.6.11/constant.sol
  100. 0
      tests/detectors/constant-function-state/0.6.11/constant.sol.0.6.11.ConstantFunctionsState.json
  101. Some files were not shown because too many files have changed in this diff Show More

@ -4,19 +4,19 @@
"elements": [
{
"type": "function",
"name": "bad4",
"name": "bad3",
"source_mapping": {
"start": 1296,
"length": 148,
"start": 1076,
"length": 154,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
44,
45,
46
39,
40,
41
],
"starting_column": 3,
"ending_column": 4
@ -29,9 +29,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -136,42 +136,42 @@
"ending_column": 2
}
},
"signature": "bad4()"
"signature": "bad3()"
}
},
{
"type": "node",
"name": "event1_bad(bad_arr)",
"name": "b = abi.encode(s)",
"source_mapping": {
"start": 1415,
"length": 24,
"start": 1195,
"length": 30,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
45
40
],
"starting_column": 5,
"ending_column": 29
"ending_column": 35
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad4",
"name": "bad3",
"source_mapping": {
"start": 1296,
"length": 148,
"start": 1076,
"length": 154,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
44,
45,
46
39,
40,
41
],
"starting_column": 3,
"ending_column": 4
@ -184,9 +184,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -291,16 +291,16 @@
"ending_column": 2
}
},
"signature": "bad4()"
"signature": "bad3()"
}
}
}
}
],
"description": "Function A.bad4() (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#44-46) trigger an abi encoding bug:\n\t- event1_bad(bad_arr) (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#45)\n",
"markdown": "Function [A.bad4()](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L44-L46) trigger an abi encoding bug:\n\t- [event1_bad(bad_arr)](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L45)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L44-L46",
"id": "a0f90ebd7deb3917f2b20550e5edc7749a3459d075ada68b6422521732674f8c",
"description": "Function A.bad3() (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#39-41) trigger an abi encoding bug:\n\t- b = abi.encode(s) (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#40)\n",
"markdown": "Function [A.bad3()](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L39-L41) trigger an abi encoding bug:\n\t- [b = abi.encode(s)](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L40)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L39-L41",
"id": "0c50cf7f7b16d965ef04035beb09d25f3fa1fa4afeeb079ea42f2db879e8f1e9",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"
@ -309,19 +309,19 @@
"elements": [
{
"type": "function",
"name": "bad2",
"name": "bad0",
"source_mapping": {
"start": 852,
"length": 160,
"start": 540,
"length": 61,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
34,
35,
36
21,
22,
23
],
"starting_column": 3,
"ending_column": 4
@ -334,9 +334,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -441,42 +441,42 @@
"ending_column": 2
}
},
"signature": "bad2()"
"signature": "bad0()"
}
},
{
"type": "node",
"name": "b = abi.encode(bad_arr)",
"name": "this.bad0_external(bad_arr)",
"source_mapping": {
"start": 971,
"length": 36,
"start": 569,
"length": 27,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
35
22
],
"starting_column": 5,
"ending_column": 41
"ending_column": 32
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad2",
"name": "bad0",
"source_mapping": {
"start": 852,
"length": 160,
"start": 540,
"length": 61,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
34,
35,
36
21,
22,
23
],
"starting_column": 3,
"ending_column": 4
@ -489,9 +489,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -596,16 +596,16 @@
"ending_column": 2
}
},
"signature": "bad2()"
"signature": "bad0()"
}
}
}
}
],
"description": "Function A.bad2() (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#34-36) trigger an abi encoding bug:\n\t- b = abi.encode(bad_arr) (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#35)\n",
"markdown": "Function [A.bad2()](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L34-L36) trigger an abi encoding bug:\n\t- [b = abi.encode(bad_arr)](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L35)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L34-L36",
"id": "767bd12bc81a7530972b0f2b069fb167efe0f2d6b6ec6d1b95aa39d1dd836a5d",
"description": "Function A.bad0() (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#21-23) trigger an abi encoding bug:\n\t- this.bad0_external(bad_arr) (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#22)\n",
"markdown": "Function [A.bad0()](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L21-L23) trigger an abi encoding bug:\n\t- [this.bad0_external(bad_arr)](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L22)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L21-L23",
"id": "3752da45df0ba78cc9ac01a10b398e4ad74e6ddd572764cf2f361e523a43a998",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"
@ -614,19 +614,19 @@
"elements": [
{
"type": "function",
"name": "bad0",
"name": "bad1",
"source_mapping": {
"start": 540,
"length": 61,
"start": 726,
"length": 63,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
21,
22,
23
29,
30,
31
],
"starting_column": 3,
"ending_column": 4
@ -639,9 +639,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -746,42 +746,42 @@
"ending_column": 2
}
},
"signature": "bad0()"
"signature": "bad1(A.S[3])"
}
},
{
"type": "node",
"name": "this.bad0_external(bad_arr)",
"name": "this.bad1_external(s)",
"source_mapping": {
"start": 569,
"length": 27,
"start": 763,
"length": 21,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
22
30
],
"starting_column": 5,
"ending_column": 32
"ending_column": 26
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad0",
"name": "bad1",
"source_mapping": {
"start": 540,
"length": 61,
"start": 726,
"length": 63,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
21,
22,
23
29,
30,
31
],
"starting_column": 3,
"ending_column": 4
@ -794,9 +794,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -901,16 +901,16 @@
"ending_column": 2
}
},
"signature": "bad0()"
"signature": "bad1(A.S[3])"
}
}
}
}
],
"description": "Function A.bad0() (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#21-23) trigger an abi encoding bug:\n\t- this.bad0_external(bad_arr) (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#22)\n",
"markdown": "Function [A.bad0()](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L21-L23) trigger an abi encoding bug:\n\t- [this.bad0_external(bad_arr)](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L22)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L21-L23",
"id": "42e7d1c56e5298ef4ddfcc69b4e6119d356b34740cde285337501b656b0d2e04",
"description": "Function A.bad1(A.S[3]) (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#29-31) trigger an abi encoding bug:\n\t- this.bad1_external(s) (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#30)\n",
"markdown": "Function [A.bad1(A.S[3])](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L29-L31) trigger an abi encoding bug:\n\t- [this.bad1_external(s)](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L30)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L29-L31",
"id": "3febdd98f71332c80290c9557c5ef89ea9dbea4f520a084b0307f21b00da5010",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"
@ -919,19 +919,19 @@
"elements": [
{
"type": "function",
"name": "bad3",
"name": "bad5",
"source_mapping": {
"start": 1076,
"length": 154,
"start": 1511,
"length": 142,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
39,
40,
41
49,
50,
51
],
"starting_column": 3,
"ending_column": 4
@ -944,9 +944,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -1051,42 +1051,42 @@
"ending_column": 2
}
},
"signature": "bad3()"
"signature": "bad5()"
}
},
{
"type": "node",
"name": "b = abi.encode(s)",
"name": "event2_bad(s)",
"source_mapping": {
"start": 1195,
"length": 30,
"start": 1630,
"length": 18,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
40
50
],
"starting_column": 5,
"ending_column": 35
"ending_column": 23
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad3",
"name": "bad5",
"source_mapping": {
"start": 1076,
"length": 154,
"start": 1511,
"length": 142,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
39,
40,
41
49,
50,
51
],
"starting_column": 3,
"ending_column": 4
@ -1099,9 +1099,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -1206,16 +1206,16 @@
"ending_column": 2
}
},
"signature": "bad3()"
"signature": "bad5()"
}
}
}
}
],
"description": "Function A.bad3() (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#39-41) trigger an abi encoding bug:\n\t- b = abi.encode(s) (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#40)\n",
"markdown": "Function [A.bad3()](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L39-L41) trigger an abi encoding bug:\n\t- [b = abi.encode(s)](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L40)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L39-L41",
"id": "2052add742fb8dc3fa2c9ce9f9adcf8515d049c55f39f32a405ef0f6c29b9c7f",
"description": "Function A.bad5() (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#49-51) trigger an abi encoding bug:\n\t- event2_bad(s) (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#50)\n",
"markdown": "Function [A.bad5()](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L49-L51) trigger an abi encoding bug:\n\t- [event2_bad(s)](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L50)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L49-L51",
"id": "e77767c95f4548636027a859ca0c63402cfb50af242f116dd3cfc5b038a4128e",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"
@ -1224,19 +1224,19 @@
"elements": [
{
"type": "function",
"name": "bad5",
"name": "bad4",
"source_mapping": {
"start": 1511,
"length": 142,
"start": 1296,
"length": 148,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
49,
50,
51
44,
45,
46
],
"starting_column": 3,
"ending_column": 4
@ -1249,9 +1249,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -1356,42 +1356,42 @@
"ending_column": 2
}
},
"signature": "bad5()"
"signature": "bad4()"
}
},
{
"type": "node",
"name": "event2_bad(s)",
"name": "event1_bad(bad_arr)",
"source_mapping": {
"start": 1630,
"length": 18,
"start": 1415,
"length": 24,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
50
45
],
"starting_column": 5,
"ending_column": 23
"ending_column": 29
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad5",
"name": "bad4",
"source_mapping": {
"start": 1511,
"length": 142,
"start": 1296,
"length": 148,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
49,
50,
51
44,
45,
46
],
"starting_column": 3,
"ending_column": 4
@ -1404,9 +1404,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -1511,16 +1511,16 @@
"ending_column": 2
}
},
"signature": "bad5()"
"signature": "bad4()"
}
}
}
}
],
"description": "Function A.bad5() (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#49-51) trigger an abi encoding bug:\n\t- event2_bad(s) (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#50)\n",
"markdown": "Function [A.bad5()](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L49-L51) trigger an abi encoding bug:\n\t- [event2_bad(s)](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L50)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L49-L51",
"id": "1bb85eee97769e9220dcde2102945a4a66fb96f01f789049334828e9f002aef5",
"description": "Function A.bad4() (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#44-46) trigger an abi encoding bug:\n\t- event1_bad(bad_arr) (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#45)\n",
"markdown": "Function [A.bad4()](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L44-L46) trigger an abi encoding bug:\n\t- [event1_bad(bad_arr)](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L45)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L44-L46",
"id": "144c77aebb4037fe38c2864892ecb888a4fb7d5e92e321e664b2d2226658a166",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"
@ -1529,19 +1529,19 @@
"elements": [
{
"type": "function",
"name": "bad1",
"name": "bad2",
"source_mapping": {
"start": 726,
"length": 63,
"start": 852,
"length": 160,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
29,
30,
31
34,
35,
36
],
"starting_column": 3,
"ending_column": 4
@ -1554,9 +1554,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -1661,42 +1661,42 @@
"ending_column": 2
}
},
"signature": "bad1(A.S[3])"
"signature": "bad2()"
}
},
{
"type": "node",
"name": "this.bad1_external(s)",
"name": "b = abi.encode(bad_arr)",
"source_mapping": {
"start": 763,
"length": 21,
"start": 971,
"length": 36,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
30
35
],
"starting_column": 5,
"ending_column": 26
"ending_column": 41
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"name": "bad2",
"source_mapping": {
"start": 726,
"length": 63,
"start": 852,
"length": 160,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
29,
30,
31
34,
35,
36
],
"starting_column": 3,
"ending_column": 4
@ -1709,9 +1709,9 @@
"start": 35,
"length": 2982,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_relative": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol",
"filename_short": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol",
"is_dependency": false,
"lines": [
3,
@ -1816,16 +1816,16 @@
"ending_column": 2
}
},
"signature": "bad1(A.S[3])"
"signature": "bad2()"
}
}
}
}
],
"description": "Function A.bad1(A.S[3]) (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#29-31) trigger an abi encoding bug:\n\t- this.bad1_external(s) (tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#30)\n",
"markdown": "Function [A.bad1(A.S[3])](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L29-L31) trigger an abi encoding bug:\n\t- [this.bad1_external(s)](tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L30)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/storage_ABIEncoderV2_array.sol#L29-L31",
"id": "b57e7fe9f889943ab7d2d9879a1b13f52d3ed64db56ae2f14cbea6e8dafcd70b",
"description": "Function A.bad2() (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#34-36) trigger an abi encoding bug:\n\t- b = abi.encode(bad_arr) (tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#35)\n",
"markdown": "Function [A.bad2()](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L34-L36) trigger an abi encoding bug:\n\t- [b = abi.encode(bad_arr)](tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L35)\n",
"first_markdown_element": "tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol#L34-L36",
"id": "d5860309d331920d1e3f44508fea706df75a4a7c2e93666ca96ca00ef32d7e01",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"

@ -0,0 +1,99 @@
pragma experimental ABIEncoderV2;
contract A {
struct S {
uint i;
}
uint[2][3] bad_arr = [[1, 2], [3, 4], [5, 6]];
uint[3] good_arr = [1, 2, 3];
S[3] s;
event event1_bad(uint[2][3] bad_arr);
event event1_good(uint[3] good_arr);
event event2_bad(S[3] s);
function bad0_external(uint [2][3] calldata arr1) external {
}
/* Array of arrays passed to an external function is vulnerable */
function bad0() public {
this.bad0_external(bad_arr);
}
function bad1_external (S[3] calldata s1) external {
}
/* Array of structs passed to an external function is vulnerable */
function bad1 (S[3] memory s1) public {
this.bad1_external(s);
}
/* Array of arrays passed to abi.encode is vulnerable */
function bad2() public {
bytes memory b = abi.encode(bad_arr);
}
/* Array of structs passed to abi.encode is vulnerable */
function bad3() public {
bytes memory b = abi.encode(s);
}
/* Array of arrays passed to an event emit is vulnerable */
function bad4() public {
emit event1_bad(bad_arr);
}
/* Array of structs passed to an event emit is vulnerable */
function bad5() public {
emit event2_bad(s);
}
function good0_public (uint[2][3] memory arr1) public {
}
/* Array of arrays passed to a public function is benign */
function good0() public {
good0_public(bad_arr);
}
function good1_public (S[3] memory s1) public {
}
/* Array of structs passed to a public function is benign */
function good1 (S[3] memory s1) public {
good1_public(s);
}
/* Array of arrays in-memory passed to abi.encode is benign */
function good2() public {
uint8 [2][3] memory bad_arr_mem = [[1, 2], [3, 4], [5, 6]];
bytes memory b = abi.encode(bad_arr_mem);
}
/* Array of structs in-memory passed to abi.encode is benign */
function good3() public {
S[3] memory s_mem;
bytes memory b = abi.encode(s_mem);
}
function good4_external(uint[3] calldata arr1) external {
}
/* Array of elementary types passed to external function is benign */
function good4() public {
this.good4_external(good_arr);
}
/* Array of elementary types passed to abi.encode is benign */
function good5() public {
bytes memory b = abi.encode(good_arr);
}
/* Array of elementary types passed to event emit is benign */
function good6() public {
emit event1_good(good_arr);
}
}

@ -0,0 +1,99 @@
pragma experimental ABIEncoderV2;
contract A {
struct S {
uint i;
}
uint[2][3] bad_arr = [[1, 2], [3, 4], [5, 6]];
uint[3] good_arr = [1, 2, 3];
S[3] s;
event event1_bad(uint[2][3] bad_arr);
event event1_good(uint[3] good_arr);
event event2_bad(S[3] s);
function good7_external(uint [2][3] calldata arr1) external {
}
/* Array of arrays passed to an external function is vulnerable */
function good7() public {
this.good7_external(bad_arr);
}
function good8_external (S[3] calldata s1) external {
}
/* Array of structs passed to an external function is vulnerable */
function good8 (S[3] memory s1) public {
this.good8_external(s);
}
/* Array of arrays passed to abi.encode is vulnerable */
function good9() public {
bytes memory b = abi.encode(bad_arr);
}
/* Array of structs passed to abi.encode is vulnerable */
function good10() public {
bytes memory b = abi.encode(s);
}
/* Array of arrays passed to an event emit is vulnerable */
function good11() public {
emit event1_bad(bad_arr);
}
/* Array of structs passed to an event emit is vulnerable */
function good12() public {
emit event2_bad(s);
}
function good0_public (uint[2][3] memory arr1) public {
}
/* Array of arrays passed to a public function is benign */
function good0() public {
good0_public(bad_arr);
}
function good1_public (S[3] memory s1) public {
}
/* Array of structs passed to a public function is benign */
function good1 (S[3] memory s1) public {
good1_public(s);
}
/* Array of arrays in-memory passed to abi.encode is benign */
function good2() public {
uint8 [2][3] memory bad_arr_mem = [[1, 2], [3, 4], [5, 6]];
bytes memory b = abi.encode(bad_arr_mem);
}
/* Array of structs in-memory passed to abi.encode is benign */
function good3() public {
S[3] memory s_mem;
bytes memory b = abi.encode(s_mem);
}
function good4_external(uint[3] calldata arr1) external {
}
/* Array of elementary types passed to external function is benign */
function good4() public {
this.good4_external(good_arr);
}
/* Array of elementary types passed to abi.encode is benign */
function good5() public {
bytes memory b = abi.encode(good_arr);
}
/* Array of elementary types passed to event emit is benign */
function good6() public {
emit event1_good(good_arr);
}
}

@ -9,9 +9,9 @@
"start": 147,
"length": 79,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"is_dependency": false,
"lines": [
11,
@ -29,9 +29,9 @@
"start": 0,
"length": 869,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"is_dependency": false,
"lines": [
1,
@ -90,9 +90,9 @@
"start": 181,
"length": 38,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"is_dependency": false,
"lines": [
12
@ -108,9 +108,9 @@
"start": 147,
"length": 79,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"is_dependency": false,
"lines": [
11,
@ -128,9 +128,9 @@
"start": 0,
"length": 869,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"is_dependency": false,
"lines": [
1,
@ -185,10 +185,10 @@
}
}
],
"description": "Test.direct() (tests/detectors/arbitrary-send/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send/arbitrary_send.sol#12)\n",
"markdown": "[Test.direct()](tests/detectors/arbitrary-send/arbitrary_send.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send/arbitrary_send.sol#L12)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/arbitrary_send.sol#L11-L13",
"id": "62016ac9363a509bd815fc0bb31b326b235dad50d7771dea249037d40169138e",
"description": "Test.direct() (tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#12)\n",
"markdown": "[Test.direct()](tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L12)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L11-L13",
"id": "477cc1ab9fa3d2263400e47d09146eaed3e478f5eecf7856b59d49a2a5093a1c",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"
@ -202,9 +202,9 @@
"start": 301,
"length": 82,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"is_dependency": false,
"lines": [
19,
@ -222,9 +222,9 @@
"start": 0,
"length": 869,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"is_dependency": false,
"lines": [
1,
@ -283,9 +283,9 @@
"start": 337,
"length": 39,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"is_dependency": false,
"lines": [
20
@ -301,9 +301,9 @@
"start": 301,
"length": 82,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"is_dependency": false,
"lines": [
19,
@ -321,9 +321,9 @@
"start": 0,
"length": 869,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send.sol",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"is_dependency": false,
"lines": [
1,
@ -378,10 +378,10 @@
}
}
],
"description": "Test.indirect() (tests/detectors/arbitrary-send/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send/arbitrary_send.sol#20)\n",
"markdown": "[Test.indirect()](tests/detectors/arbitrary-send/arbitrary_send.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send/arbitrary_send.sol#L20)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/arbitrary_send.sol#L19-L21",
"id": "62a25f56dfce54ce59cdf81a1821f2ea8a8eb7d12a6a794b9c4f09ba7f7bc543",
"description": "Test.indirect() (tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#20)\n",
"markdown": "[Test.indirect()](tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L20)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L19-L21",
"id": "4759805615df746a3d8a6c068ce885d2c18c46edf411f83ae004593958caafe7",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"

@ -0,0 +1,390 @@
[
[
{
"elements": [
{
"type": "function",
"name": "direct",
"source_mapping": {
"start": 162,
"length": 79,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"is_dependency": false,
"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
}
},
"signature": "direct()"
}
},
{
"type": "node",
"name": "msg.sender.send(address(this).balance)",
"source_mapping": {
"start": 196,
"length": 38,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"is_dependency": false,
"lines": [
12
],
"starting_column": 9,
"ending_column": 47
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "direct",
"source_mapping": {
"start": 162,
"length": 79,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"is_dependency": false,
"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
}
},
"signature": "direct()"
}
}
}
}
],
"description": "Test.direct() (tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#12)\n",
"markdown": "[Test.direct()](tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L12)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L11-L13",
"id": "9531cafd91af4d7b54f22fa933dae983077df1c51bd855c2516ffee812911f43",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"
},
{
"elements": [
{
"type": "function",
"name": "indirect",
"source_mapping": {
"start": 316,
"length": 82,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"is_dependency": false,
"lines": [
19,
20,
21
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"is_dependency": false,
"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
}
},
"signature": "indirect()"
}
},
{
"type": "node",
"name": "destination.send(address(this).balance)",
"source_mapping": {
"start": 352,
"length": 39,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"is_dependency": false,
"lines": [
20
],
"starting_column": 9,
"ending_column": 48
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "indirect",
"source_mapping": {
"start": 316,
"length": 82,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"is_dependency": false,
"lines": [
19,
20,
21
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol",
"is_dependency": false,
"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
}
},
"signature": "indirect()"
}
}
}
}
],
"description": "Test.indirect() (tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#20)\n",
"markdown": "[Test.indirect()](tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L20)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L19-L21",
"id": "f1395ebf21de9f8fb2c5d254c5990cce55b239c05a6a5e074813f58c6cd32834",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"
}
]
]

@ -0,0 +1,41 @@
contract Test{
address payable destination;
mapping (address => uint) balances;
constructor() public{
balances[msg.sender] = 0;
}
function direct() public{
msg.sender.send(address(this).balance);
}
function init() public{
destination = msg.sender;
}
function indirect() public{
destination.send(address(this).balance);
}
// these are legitimate calls
// and should not be detected
function repay() payable public{
msg.sender.transfer(msg.value);
}
function withdraw() public{
uint val = balances[msg.sender];
msg.sender.send(val);
}
function buy() payable public{
uint value_send = msg.value;
uint value_spent = 0 ; // simulate a buy of tokens
uint remaining = value_send - value_spent;
msg.sender.send(remaining);
}
}

@ -0,0 +1,390 @@
[
[
{
"elements": [
{
"type": "function",
"name": "direct",
"source_mapping": {
"start": 162,
"length": 79,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"is_dependency": false,
"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
}
},
"signature": "direct()"
}
},
{
"type": "node",
"name": "msg.sender.send(address(this).balance)",
"source_mapping": {
"start": 196,
"length": 38,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"is_dependency": false,
"lines": [
12
],
"starting_column": 9,
"ending_column": 47
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "direct",
"source_mapping": {
"start": 162,
"length": 79,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"is_dependency": false,
"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
}
},
"signature": "direct()"
}
}
}
}
],
"description": "Test.direct() (tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#12)\n",
"markdown": "[Test.direct()](tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L12)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L11-L13",
"id": "8a1de239f630f10fef9ef6a9c439fc10aad2f6caba7ee43d1a7f7bacf6028f1e",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"
},
{
"elements": [
{
"type": "function",
"name": "indirect",
"source_mapping": {
"start": 316,
"length": 82,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"is_dependency": false,
"lines": [
19,
20,
21
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"is_dependency": false,
"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
}
},
"signature": "indirect()"
}
},
{
"type": "node",
"name": "destination.send(address(this).balance)",
"source_mapping": {
"start": 352,
"length": 39,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"is_dependency": false,
"lines": [
20
],
"starting_column": 9,
"ending_column": 48
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "indirect",
"source_mapping": {
"start": 316,
"length": 82,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"is_dependency": false,
"lines": [
19,
20,
21
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "Test",
"source_mapping": {
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol",
"is_dependency": false,
"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
}
},
"signature": "indirect()"
}
}
}
}
],
"description": "Test.indirect() (tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#20)\n",
"markdown": "[Test.indirect()](tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L20)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L19-L21",
"id": "f272e05d9741895fc22051ed09afa6ce4af8ad4cd74b3452224dfb29eb4b9df6",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"
}
]
]

@ -0,0 +1,41 @@
contract Test{
address payable destination;
mapping (address => uint) balances;
constructor() public{
balances[msg.sender] = 0;
}
function direct() public{
msg.sender.send(address(this).balance);
}
function init() public{
destination = msg.sender;
}
function indirect() public{
destination.send(address(this).balance);
}
// these are legitimate calls
// and should not be detected
function repay() payable public{
msg.sender.transfer(msg.value);
}
function withdraw() public{
uint val = balances[msg.sender];
msg.sender.send(val);
}
function buy() payable public{
uint value_send = msg.value;
uint value_spent = 0 ; // simulate a buy of tokens
uint remaining = value_send - value_spent;
msg.sender.send(remaining);
}
}

@ -9,9 +9,9 @@
"start": 162,
"length": 79,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"is_dependency": false,
"lines": [
11,
@ -29,9 +29,9 @@
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"is_dependency": false,
"lines": [
1,
@ -90,9 +90,9 @@
"start": 196,
"length": 38,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"is_dependency": false,
"lines": [
12
@ -108,9 +108,9 @@
"start": 162,
"length": 79,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"is_dependency": false,
"lines": [
11,
@ -128,9 +128,9 @@
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"is_dependency": false,
"lines": [
1,
@ -185,10 +185,10 @@
}
}
],
"description": "Test.direct() (tests/detectors/arbitrary-send/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/detectors/arbitrary-send/arbitrary_send-0.5.1.sol#12)\n",
"markdown": "[Test.direct()](tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol#L12)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol#L11-L13",
"id": "f541c43a03086c95960bfcf05b8d4941008505120331df11a91d0187dc4640c5",
"description": "Test.direct() (tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#12)\n",
"markdown": "[Test.direct()](tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L12)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L11-L13",
"id": "90d9178119fb586af18c2298136d7f1af4d33a9b702b94d2ca0fcdbe6ee783c6",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"
@ -202,9 +202,9 @@
"start": 316,
"length": 82,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"is_dependency": false,
"lines": [
19,
@ -222,9 +222,9 @@
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"is_dependency": false,
"lines": [
1,
@ -283,9 +283,9 @@
"start": 352,
"length": 39,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"is_dependency": false,
"lines": [
20
@ -301,9 +301,9 @@
"start": 316,
"length": 82,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"is_dependency": false,
"lines": [
19,
@ -321,9 +321,9 @@
"start": 0,
"length": 884,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol",
"filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol",
"is_dependency": false,
"lines": [
1,
@ -378,10 +378,10 @@
}
}
],
"description": "Test.indirect() (tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol#20)\n",
"markdown": "[Test.indirect()](tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol#L20)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/arbitrary_send-0.5.1.sol#L19-L21",
"id": "6399c3b0638ef3e8fb62de3d7ad760649d315b03ebdf5a11d2674970f12452d9",
"description": "Test.indirect() (tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#20)\n",
"markdown": "[Test.indirect()](tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L20)\n",
"first_markdown_element": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L19-L21",
"id": "3bf41470de6f5fec21d1da5741e7d63ee1d3b63cfd2646d697274f4495e3f1a9",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"

@ -9,9 +9,9 @@
"start": 40,
"length": 167,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
4,
@ -31,9 +31,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -80,9 +80,9 @@
"start": 17,
"length": 16,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
2
@ -98,9 +98,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -146,9 +146,9 @@
"start": 498,
"length": 67,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
21,
@ -166,9 +166,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -209,9 +209,9 @@
}
}
],
"description": "C.f() (tests/detectors/array-by-reference/array_by_reference.sol#4-8) passes array C.x (tests/detectors/array-by-reference/array_by_reference.sol#2)by reference to C.setByValue(uint256[1]) (tests/detectors/array-by-reference/array_by_reference.sol#21-23)which only takes arrays by value\n",
"markdown": "[C.f()](tests/detectors/array-by-reference/array_by_reference.sol#L4-L8) passes array [C.x](tests/detectors/array-by-reference/array_by_reference.sol#L2)by reference to [C.setByValue(uint256[1])](tests/detectors/array-by-reference/array_by_reference.sol#L21-L23)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/array_by_reference.sol#L4-L8",
"description": "C.f() (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#4-8) passes array C.x (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#2)by reference to C.setByValue(uint256[1]) (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#21-23)which only takes arrays by value\n",
"markdown": "[C.f()](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L4-L8) passes array [C.x](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L2)by reference to [C.setByValue(uint256[1])](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L21-L23)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L4-L8",
"id": "79a462bf06ae529ad099f2170100298da30766fcc06884e03436d2b53110d208",
"check": "array-by-reference",
"impact": "High",
@ -226,9 +226,9 @@
"start": 40,
"length": 167,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
4,
@ -248,9 +248,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -297,9 +297,9 @@
"start": 17,
"length": 16,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
2
@ -315,9 +315,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -363,9 +363,9 @@
"start": 571,
"length": 113,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
25,
@ -384,9 +384,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -427,9 +427,9 @@
}
}
],
"description": "C.f() (tests/detectors/array-by-reference/array_by_reference.sol#4-8) passes array C.x (tests/detectors/array-by-reference/array_by_reference.sol#2)by reference to C.setByValueAndReturn(uint256[1]) (tests/detectors/array-by-reference/array_by_reference.sol#25-28)which only takes arrays by value\n",
"markdown": "[C.f()](tests/detectors/array-by-reference/array_by_reference.sol#L4-L8) passes array [C.x](tests/detectors/array-by-reference/array_by_reference.sol#L2)by reference to [C.setByValueAndReturn(uint256[1])](tests/detectors/array-by-reference/array_by_reference.sol#L25-L28)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/array_by_reference.sol#L4-L8",
"description": "C.f() (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#4-8) passes array C.x (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#2)by reference to C.setByValueAndReturn(uint256[1]) (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#25-28)which only takes arrays by value\n",
"markdown": "[C.f()](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L4-L8) passes array [C.x](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L2)by reference to [C.setByValueAndReturn(uint256[1])](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L25-L28)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L4-L8",
"id": "7f1eda9be40002affd2e8e31d172d3ee3374f37b1106118c79f4add7a133bbd0",
"check": "array-by-reference",
"impact": "High",
@ -444,9 +444,9 @@
"start": 213,
"length": 198,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
10,
@ -467,9 +467,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -516,9 +516,9 @@
"start": 243,
"length": 21,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
11
@ -534,9 +534,9 @@
"start": 213,
"length": 198,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
10,
@ -557,9 +557,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -608,9 +608,9 @@
"start": 498,
"length": 67,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
21,
@ -628,9 +628,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -671,9 +671,9 @@
}
}
],
"description": "C.g() (tests/detectors/array-by-reference/array_by_reference.sol#10-15) passes array C.g().y (tests/detectors/array-by-reference/array_by_reference.sol#11)by reference to C.setByValue(uint256[1]) (tests/detectors/array-by-reference/array_by_reference.sol#21-23)which only takes arrays by value\n",
"markdown": "[C.g()](tests/detectors/array-by-reference/array_by_reference.sol#L10-L15) passes array [C.g().y](tests/detectors/array-by-reference/array_by_reference.sol#L11)by reference to [C.setByValue(uint256[1])](tests/detectors/array-by-reference/array_by_reference.sol#L21-L23)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/array_by_reference.sol#L10-L15",
"description": "C.g() (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#10-15) passes array C.g().y (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#11)by reference to C.setByValue(uint256[1]) (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#21-23)which only takes arrays by value\n",
"markdown": "[C.g()](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L10-L15) passes array [C.g().y](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L11)by reference to [C.setByValue(uint256[1])](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L21-L23)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L10-L15",
"id": "d039169712808e785bf2e53f322c1c6fcd6b93a0a0c17f1a701addd09ed83996",
"check": "array-by-reference",
"impact": "High",
@ -688,9 +688,9 @@
"start": 213,
"length": 198,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
10,
@ -711,9 +711,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -760,9 +760,9 @@
"start": 243,
"length": 21,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
11
@ -778,9 +778,9 @@
"start": 213,
"length": 198,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
10,
@ -801,9 +801,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -852,9 +852,9 @@
"start": 571,
"length": 113,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
25,
@ -873,9 +873,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -916,9 +916,9 @@
}
}
],
"description": "C.g() (tests/detectors/array-by-reference/array_by_reference.sol#10-15) passes array C.g().y (tests/detectors/array-by-reference/array_by_reference.sol#11)by reference to C.setByValueAndReturn(uint256[1]) (tests/detectors/array-by-reference/array_by_reference.sol#25-28)which only takes arrays by value\n",
"markdown": "[C.g()](tests/detectors/array-by-reference/array_by_reference.sol#L10-L15) passes array [C.g().y](tests/detectors/array-by-reference/array_by_reference.sol#L11)by reference to [C.setByValueAndReturn(uint256[1])](tests/detectors/array-by-reference/array_by_reference.sol#L25-L28)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/array_by_reference.sol#L10-L15",
"description": "C.g() (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#10-15) passes array C.g().y (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#11)by reference to C.setByValueAndReturn(uint256[1]) (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#25-28)which only takes arrays by value\n",
"markdown": "[C.g()](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L10-L15) passes array [C.g().y](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L11)by reference to [C.setByValueAndReturn(uint256[1])](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L25-L28)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L10-L15",
"id": "8655e8acd84a6e8152acd2d9730ea0dfdda0723e09b2dcbfdbbeb8da8bd04fa5",
"check": "array-by-reference",
"impact": "High",
@ -933,9 +933,9 @@
"start": 855,
"length": 269,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
42,
@ -957,9 +957,9 @@
"start": 688,
"length": 440,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
31,
@ -999,9 +999,9 @@
"start": 822,
"length": 9,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
39
@ -1017,9 +1017,9 @@
"start": 688,
"length": 440,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
31,
@ -1058,9 +1058,9 @@
"start": 498,
"length": 67,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
21,
@ -1078,9 +1078,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -1121,9 +1121,9 @@
}
}
],
"description": "D.f() (tests/detectors/array-by-reference/array_by_reference.sol#42-48) passes array D.x (tests/detectors/array-by-reference/array_by_reference.sol#39)by reference to C.setByValue(uint256[1]) (tests/detectors/array-by-reference/array_by_reference.sol#21-23)which only takes arrays by value\n",
"markdown": "[D.f()](tests/detectors/array-by-reference/array_by_reference.sol#L42-L48) passes array [D.x](tests/detectors/array-by-reference/array_by_reference.sol#L39)by reference to [C.setByValue(uint256[1])](tests/detectors/array-by-reference/array_by_reference.sol#L21-L23)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/array_by_reference.sol#L42-L48",
"description": "D.f() (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#42-48) passes array D.x (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#39)by reference to C.setByValue(uint256[1]) (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#21-23)which only takes arrays by value\n",
"markdown": "[D.f()](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L42-L48) passes array [D.x](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L39)by reference to [C.setByValue(uint256[1])](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L21-L23)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L42-L48",
"id": "1520955a53c36e391abbaf648a91a5a12d432f0f4746b0a8187d0988a6a66846",
"check": "array-by-reference",
"impact": "High",
@ -1138,9 +1138,9 @@
"start": 855,
"length": 269,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
42,
@ -1162,9 +1162,9 @@
"start": 688,
"length": 440,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
31,
@ -1204,9 +1204,9 @@
"start": 822,
"length": 9,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
39
@ -1222,9 +1222,9 @@
"start": 688,
"length": 440,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
31,
@ -1263,9 +1263,9 @@
"start": 571,
"length": 113,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
25,
@ -1284,9 +1284,9 @@
"start": 0,
"length": 686,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_relative": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/array-by-reference/array_by_reference.sol",
"filename_short": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol",
"is_dependency": false,
"lines": [
1,
@ -1327,9 +1327,9 @@
}
}
],
"description": "D.f() (tests/detectors/array-by-reference/array_by_reference.sol#42-48) passes array D.x (tests/detectors/array-by-reference/array_by_reference.sol#39)by reference to C.setByValueAndReturn(uint256[1]) (tests/detectors/array-by-reference/array_by_reference.sol#25-28)which only takes arrays by value\n",
"markdown": "[D.f()](tests/detectors/array-by-reference/array_by_reference.sol#L42-L48) passes array [D.x](tests/detectors/array-by-reference/array_by_reference.sol#L39)by reference to [C.setByValueAndReturn(uint256[1])](tests/detectors/array-by-reference/array_by_reference.sol#L25-L28)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/array_by_reference.sol#L42-L48",
"description": "D.f() (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#42-48) passes array D.x (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#39)by reference to C.setByValueAndReturn(uint256[1]) (tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#25-28)which only takes arrays by value\n",
"markdown": "[D.f()](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L42-L48) passes array [D.x](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L39)by reference to [C.setByValueAndReturn(uint256[1])](tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L25-L28)which only takes arrays by value\n",
"first_markdown_element": "tests/detectors/array-by-reference/0.4.25/array_by_reference.sol#L42-L48",
"id": "019912974eabe7e8b1e67ca05b342e5106de13fa93fa0adf599a4259c425bd54",
"check": "array-by-reference",
"impact": "High",

@ -0,0 +1,51 @@
contract C {
uint[1] public x;
function f() public {
setByRef(x); // can set x.
setByValue(x); // cannot set x.
uint test = 1 + setByValueAndReturn(x); // cannot set x.
}
function g() public {
uint[1] storage y = x;
setByRef(y); // can set y.
setByValue(y); // cannot set y.
uint test = 1 + setByValueAndReturn(y); // cannot set y.
}
function setByRef(uint[1] storage arr) internal {
arr[0] = 1;
}
function setByValue(uint[1] memory arr) public {
arr[0] = 2;
}
function setByValueAndReturn(uint[1] memory arr) public returns(uint) {
arr[0] = 2;
return arr[0];
}
}
contract D {
// Struct definition
struct TestStruct {
uint[1] x;
}
// State Variables
TestStruct ts;
uint[1] x;
// Functions
function f() public {
C c = new C();
c.setByValue(ts.x); // cannot set x.
uint test = 1 + c.setByValueAndReturn(ts.x); // cannot set x.
c.setByValue(x); // cannot set x.
test = 1 + c.setByValueAndReturn(x); // cannot set x.
}
}

@ -0,0 +1,51 @@
contract C {
uint[1] public x;
function f() public {
setByRef(x); // can set x.
setByValue(x); // cannot set x.
uint test = 1 + setByValueAndReturn(x); // cannot set x.
}
function g() public {
uint[1] storage y = x;
setByRef(y); // can set y.
setByValue(y); // cannot set y.
uint test = 1 + setByValueAndReturn(y); // cannot set y.
}
function setByRef(uint[1] storage arr) internal {
arr[0] = 1;
}
function setByValue(uint[1] memory arr) public {
arr[0] = 2;
}
function setByValueAndReturn(uint[1] memory arr) public returns(uint) {
arr[0] = 2;
return arr[0];
}
}
contract D {
// Struct definition
struct TestStruct {
uint[1] x;
}
// State Variables
TestStruct ts;
uint[1] x;
// Functions
function f() public {
C c = new C();
c.setByValue(ts.x); // cannot set x.
uint test = 1 + c.setByValueAndReturn(ts.x); // cannot set x.
c.setByValue(x); // cannot set x.
test = 1 + c.setByValueAndReturn(x); // cannot set x.
}
}

@ -0,0 +1,51 @@
contract C {
uint[1] public x;
function f() public {
setByRef(x); // can set x.
setByValue(x); // cannot set x.
uint test = 1 + setByValueAndReturn(x); // cannot set x.
}
function g() public {
uint[1] storage y = x;
setByRef(y); // can set y.
setByValue(y); // cannot set y.
uint test = 1 + setByValueAndReturn(y); // cannot set y.
}
function setByRef(uint[1] storage arr) internal {
arr[0] = 1;
}
function setByValue(uint[1] memory arr) public {
arr[0] = 2;
}
function setByValueAndReturn(uint[1] memory arr) public returns(uint) {
arr[0] = 2;
return arr[0];
}
}
contract D {
// Struct definition
struct TestStruct {
uint[1] x;
}
// State Variables
TestStruct ts;
uint[1] x;
// Functions
function f() public {
C c = new C();
c.setByValue(ts.x); // cannot set x.
uint test = 1 + c.setByValueAndReturn(ts.x); // cannot set x.
c.setByValue(x); // cannot set x.
test = 1 + c.setByValueAndReturn(x); // cannot set x.
}
}

@ -9,9 +9,9 @@
"start": 119,
"length": 700,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_contract.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_contract.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
6,
@ -41,9 +41,9 @@
"start": 97,
"length": 724,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_contract.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_contract.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
5,
@ -78,9 +78,9 @@
"start": 191,
"length": 628,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_contract.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_contract.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
7,
@ -109,9 +109,9 @@
"start": 119,
"length": 700,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_contract.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_contract.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
6,
@ -141,9 +141,9 @@
"start": 97,
"length": 724,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_contract.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_contract.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
5,
@ -174,10 +174,10 @@
}
}
],
"description": "GetCode.at(address) (tests/detectors/assembly/inline_assembly_contract.sol#6-20) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/inline_assembly_contract.sol#7-20)\n",
"markdown": "[GetCode.at(address)](tests/detectors/assembly/inline_assembly_contract.sol#L6-L20) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/inline_assembly_contract.sol#L7-L20)\n",
"first_markdown_element": "tests/detectors/assembly/inline_assembly_contract.sol#L6-L20",
"id": "076a663af9edac0ed5fd4b04bb521be77206cde70d71f430b80d13896d7ad54d",
"description": "GetCode.at(address) (tests/detectors/assembly/0.4.25/inline_assembly_contract.sol#6-20) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.4.25/inline_assembly_contract.sol#7-20)\n",
"markdown": "[GetCode.at(address)](tests/detectors/assembly/0.4.25/inline_assembly_contract.sol#L6-L20) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.4.25/inline_assembly_contract.sol#L7-L20)\n",
"first_markdown_element": "tests/detectors/assembly/0.4.25/inline_assembly_contract.sol#L6-L20",
"id": "37ca62e9af93d1648d3a1aa845426ec5395eab836277e3a8baa52621bf1df7c3",
"check": "assembly",
"impact": "Informational",
"confidence": "High"

@ -9,9 +9,9 @@
"start": 593,
"length": 247,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
16,
@ -33,9 +33,9 @@
"start": 98,
"length": 1581,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
5,
@ -97,9 +97,9 @@
"start": 720,
"length": 114,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
18,
@ -118,9 +118,9 @@
"start": 593,
"length": 247,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
16,
@ -142,9 +142,9 @@
"start": 98,
"length": 1581,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
5,
@ -202,10 +202,10 @@
}
}
],
"description": "VectorSum.sumAsm(uint256[]) (tests/detectors/assembly/inline_assembly_library.sol#16-22) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/inline_assembly_library.sol#18-21)\n",
"markdown": "[VectorSum.sumAsm(uint256[])](tests/detectors/assembly/inline_assembly_library.sol#L16-L22) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/inline_assembly_library.sol#L18-L21)\n",
"first_markdown_element": "tests/detectors/assembly/inline_assembly_library.sol#L16-L22",
"id": "bb3664625e0b8ea9d3b3a564687e6ec0b403f90fe433eae80801a31e51a390b6",
"description": "VectorSum.sumAsm(uint256[]) (tests/detectors/assembly/0.4.25/inline_assembly_library.sol#16-22) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.4.25/inline_assembly_library.sol#18-21)\n",
"markdown": "[VectorSum.sumAsm(uint256[])](tests/detectors/assembly/0.4.25/inline_assembly_library.sol#L16-L22) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.4.25/inline_assembly_library.sol#L18-L21)\n",
"first_markdown_element": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol#L16-L22",
"id": "7009ef6498fa29901fbf3e9e1971a19f6fa48c87be3b2592c632e05a4321e1d3",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
@ -219,9 +219,9 @@
"start": 923,
"length": 754,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
25,
@ -259,9 +259,9 @@
"start": 98,
"length": 1581,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
5,
@ -323,9 +323,9 @@
"start": 1000,
"length": 677,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
26,
@ -362,9 +362,9 @@
"start": 923,
"length": 754,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
25,
@ -402,9 +402,9 @@
"start": 98,
"length": 1581,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_relative": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library.sol",
"filename_short": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
5,
@ -462,10 +462,10 @@
}
}
],
"description": "VectorSum.sumPureAsm(uint256[]) (tests/detectors/assembly/inline_assembly_library.sol#25-47) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/inline_assembly_library.sol#26-47)\n",
"markdown": "[VectorSum.sumPureAsm(uint256[])](tests/detectors/assembly/inline_assembly_library.sol#L25-L47) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/inline_assembly_library.sol#L26-L47)\n",
"first_markdown_element": "tests/detectors/assembly/inline_assembly_library.sol#L25-L47",
"id": "3d84d91aaec8956d18b205c8fb9c0ae40794c87060ed0bbbb0dc94eecf5b8fcb",
"description": "VectorSum.sumPureAsm(uint256[]) (tests/detectors/assembly/0.4.25/inline_assembly_library.sol#25-47) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.4.25/inline_assembly_library.sol#26-47)\n",
"markdown": "[VectorSum.sumPureAsm(uint256[])](tests/detectors/assembly/0.4.25/inline_assembly_library.sol#L25-L47) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.4.25/inline_assembly_library.sol#L26-L47)\n",
"first_markdown_element": "tests/detectors/assembly/0.4.25/inline_assembly_library.sol#L25-L47",
"id": "e6c5e2eab9e98c206f4092988fc006a6333e737680610667cba168fe739a3cf6",
"check": "assembly",
"impact": "Informational",
"confidence": "High"

@ -9,9 +9,9 @@
"start": 119,
"length": 707,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
6,
@ -41,9 +41,9 @@
"start": 97,
"length": 731,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
5,
@ -76,11 +76,11 @@
"name": "",
"source_mapping": {
"start": 198,
"length": 628,
"length": 622,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
7,
@ -95,11 +95,10 @@
16,
17,
18,
19,
20
19
],
"starting_column": 9,
"ending_column": 6
"ending_column": 10
},
"type_specific_fields": {
"parent": {
@ -109,9 +108,9 @@
"start": 119,
"length": 707,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
6,
@ -141,9 +140,9 @@
"start": 97,
"length": 731,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
5,
@ -174,10 +173,10 @@
}
}
],
"description": "GetCode.at(address) (tests/detectors/assembly/inline_assembly_contract-0.5.1.sol#6-20) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/inline_assembly_contract-0.5.1.sol#7-20)\n",
"markdown": "[GetCode.at(address)](tests/detectors/assembly/inline_assembly_contract-0.5.1.sol#L6-L20) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/inline_assembly_contract-0.5.1.sol#L7-L20)\n",
"first_markdown_element": "tests/detectors/assembly/inline_assembly_contract-0.5.1.sol#L6-L20",
"id": "a454219cba72113d0a6d0d732b998ba66db41cc59910efea1862a05d4d27f385",
"description": "GetCode.at(address) (tests/detectors/assembly/0.5.16/inline_assembly_contract.sol#6-20) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.5.16/inline_assembly_contract.sol#7-19)\n",
"markdown": "[GetCode.at(address)](tests/detectors/assembly/0.5.16/inline_assembly_contract.sol#L6-L20) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.5.16/inline_assembly_contract.sol#L7-L19)\n",
"first_markdown_element": "tests/detectors/assembly/0.5.16/inline_assembly_contract.sol#L6-L20",
"id": "ac5f8f89c2d7459785200d5d861616e04a1bbcfbb2a39cef8bef6a03222c7c21",
"check": "assembly",
"impact": "Informational",
"confidence": "High"

@ -9,9 +9,9 @@
"start": 599,
"length": 254,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
16,
@ -33,9 +33,9 @@
"start": 97,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
5,
@ -95,20 +95,19 @@
"name": "",
"source_mapping": {
"start": 733,
"length": 114,
"length": 104,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
18,
19,
20,
21
20
],
"starting_column": 13,
"ending_column": 10
"ending_column": 14
},
"type_specific_fields": {
"parent": {
@ -118,9 +117,9 @@
"start": 599,
"length": 254,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
16,
@ -142,9 +141,9 @@
"start": 97,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
5,
@ -202,10 +201,10 @@
}
}
],
"description": "VectorSum.sumAsm(uint256[]) (tests/detectors/assembly/inline_assembly_library-0.5.1.sol#16-22) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/inline_assembly_library-0.5.1.sol#18-21)\n",
"markdown": "[VectorSum.sumAsm(uint256[])](tests/detectors/assembly/inline_assembly_library-0.5.1.sol#L16-L22) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/inline_assembly_library-0.5.1.sol#L18-L21)\n",
"first_markdown_element": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol#L16-L22",
"id": "86a697fcaa68e521bef3fcba0cf80a381efeb961011f90562eab06ca08b8dc00",
"description": "VectorSum.sumAsm(uint256[]) (tests/detectors/assembly/0.5.16/inline_assembly_library.sol#16-22) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.5.16/inline_assembly_library.sol#18-20)\n",
"markdown": "[VectorSum.sumAsm(uint256[])](tests/detectors/assembly/0.5.16/inline_assembly_library.sol#L16-L22) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.5.16/inline_assembly_library.sol#L18-L20)\n",
"first_markdown_element": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol#L16-L22",
"id": "abf9dce26719358da77702aa40f23104cc83044d0b1cffb492e318360fb72b6f",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
@ -219,9 +218,9 @@
"start": 936,
"length": 761,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
25,
@ -259,9 +258,9 @@
"start": 97,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
5,
@ -321,11 +320,11 @@
"name": "",
"source_mapping": {
"start": 1020,
"length": 677,
"length": 671,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
26,
@ -348,11 +347,10 @@
43,
44,
45,
46,
47
46
],
"starting_column": 9,
"ending_column": 6
"ending_column": 10
},
"type_specific_fields": {
"parent": {
@ -362,9 +360,9 @@
"start": 936,
"length": 761,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
25,
@ -402,9 +400,9 @@
"start": 97,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_relative": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol",
"filename_short": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
5,
@ -462,10 +460,10 @@
}
}
],
"description": "VectorSum.sumPureAsm(uint256[]) (tests/detectors/assembly/inline_assembly_library-0.5.1.sol#25-47) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/inline_assembly_library-0.5.1.sol#26-47)\n",
"markdown": "[VectorSum.sumPureAsm(uint256[])](tests/detectors/assembly/inline_assembly_library-0.5.1.sol#L25-L47) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/inline_assembly_library-0.5.1.sol#L26-L47)\n",
"first_markdown_element": "tests/detectors/assembly/inline_assembly_library-0.5.1.sol#L25-L47",
"id": "e18b822185c318b5197d4704d8524a2f025a68be527e542392467920f35723b8",
"description": "VectorSum.sumPureAsm(uint256[]) (tests/detectors/assembly/0.5.16/inline_assembly_library.sol#25-47) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.5.16/inline_assembly_library.sol#26-46)\n",
"markdown": "[VectorSum.sumPureAsm(uint256[])](tests/detectors/assembly/0.5.16/inline_assembly_library.sol#L25-L47) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.5.16/inline_assembly_library.sol#L26-L46)\n",
"first_markdown_element": "tests/detectors/assembly/0.5.16/inline_assembly_library.sol#L25-L47",
"id": "c0078585e7d2fe02dda5ea48ddb48b40916db51afbee078f77bea648d1aa0315",
"check": "assembly",
"impact": "Informational",
"confidence": "High"

@ -0,0 +1,20 @@
// taken from https://solidity.readthedocs.io/en/v0.4.25/assembly.html
library GetCode {
function at(address _addr) public view returns (bytes memory o_code) {
assembly {
// retrieve the size of the code, this needs assembly
let size := extcodesize(_addr)
// allocate output byte array - this could also be done without assembly
// by using o_code = new bytes(size)
o_code := mload(0x40)
// new "memory end" including padding
mstore(0x40, add(o_code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
// store length in memory
mstore(o_code, size)
// actually retrieve the code, this needs assembly
extcodecopy(_addr, add(o_code, 0x20), 0, size)
}
}
}

@ -0,0 +1,185 @@
[
[
{
"elements": [
{
"type": "function",
"name": "at",
"source_mapping": {
"start": 94,
"length": 707,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "GetCode",
"source_mapping": {
"start": 72,
"length": 731,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "at(address)"
}
},
{
"type": "node",
"name": "",
"source_mapping": {
"start": 173,
"length": 622,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17
],
"starting_column": 9,
"ending_column": 10
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "at",
"source_mapping": {
"start": 94,
"length": 707,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "GetCode",
"source_mapping": {
"start": 72,
"length": 731,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "at(address)"
}
}
}
}
],
"description": "GetCode.at(address) (tests/detectors/assembly/0.6.11/inline_assembly_contract.sol#4-18) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.6.11/inline_assembly_contract.sol#5-17)\n",
"markdown": "[GetCode.at(address)](tests/detectors/assembly/0.6.11/inline_assembly_contract.sol#L4-L18) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.6.11/inline_assembly_contract.sol#L5-L17)\n",
"first_markdown_element": "tests/detectors/assembly/0.6.11/inline_assembly_contract.sol#L4-L18",
"id": "00e51f7f223289ebaad73cd6e77329b37ff5be360d9a682614cb6b72b8e3d9b4",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
}
]
]

@ -0,0 +1,47 @@
// taken from https://solidity.readthedocs.io/en/v0.4.25/assembly.html
library VectorSum {
// This function is less efficient because the optimizer currently fails to
// remove the bounds checks in array access.
function sumSolidity(uint[] memory _data) public view returns (uint o_sum) {
for (uint i = 0; i < _data.length; ++i)
o_sum += _data[i];
}
// We know that we only access the array in bounds, so we can avoid the check.
// 0x20 needs to be added to an array because the first slot contains the
// array length.
function sumAsm(uint[] memory _data) public view returns (uint o_sum) {
for (uint i = 0; i < _data.length; ++i) {
assembly {
o_sum := add(o_sum, mload(add(add(_data, 0x20), mul(i, 0x20))))
}
}
}
// Same as above, but accomplish the entire code within inline assembly.
function sumPureAsm(uint[] memory _data) public view returns (uint o_sum) {
assembly {
// Load the length (first 32 bytes)
let len := mload(_data)
// Skip over the length field.
//
// Keep temporary variable so it can be incremented in place.
//
// NOTE: incrementing _data would result in an unusable
// _data variable after this assembly block
let data := add(_data, 0x20)
// Iterate until the bound is not met.
for
{ let end := add(data, len) }
lt(data, end)
{ data := add(data, 0x20) }
{
o_sum := add(o_sum, mload(data))
}
}
}
}

@ -0,0 +1,472 @@
[
[
{
"elements": [
{
"type": "function",
"name": "sumAsm",
"source_mapping": {
"start": 574,
"length": 254,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18,
19,
20
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 72,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "sumAsm(uint256[])"
}
},
{
"type": "node",
"name": "",
"source_mapping": {
"start": 708,
"length": 104,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
16,
17,
18
],
"starting_column": 13,
"ending_column": 14
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "sumAsm",
"source_mapping": {
"start": 574,
"length": 254,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18,
19,
20
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 72,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "sumAsm(uint256[])"
}
}
}
}
],
"description": "VectorSum.sumAsm(uint256[]) (tests/detectors/assembly/0.6.11/inline_assembly_library.sol#14-20) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.6.11/inline_assembly_library.sol#16-18)\n",
"markdown": "[VectorSum.sumAsm(uint256[])](tests/detectors/assembly/0.6.11/inline_assembly_library.sol#L14-L20) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.6.11/inline_assembly_library.sol#L16-L18)\n",
"first_markdown_element": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol#L14-L20",
"id": "a8d71513166310212c49c4edecbdf8fbc3040b1cb5b5756f0ad1971ae7d4cdb1",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "sumPureAsm",
"source_mapping": {
"start": 911,
"length": 761,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 72,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "sumPureAsm(uint256[])"
}
},
{
"type": "node",
"name": "",
"source_mapping": {
"start": 995,
"length": 671,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44
],
"starting_column": 9,
"ending_column": 10
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "sumPureAsm",
"source_mapping": {
"start": 911,
"length": 761,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 72,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "sumPureAsm(uint256[])"
}
}
}
}
],
"description": "VectorSum.sumPureAsm(uint256[]) (tests/detectors/assembly/0.6.11/inline_assembly_library.sol#23-45) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.6.11/inline_assembly_library.sol#24-44)\n",
"markdown": "[VectorSum.sumPureAsm(uint256[])](tests/detectors/assembly/0.6.11/inline_assembly_library.sol#L23-L45) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.6.11/inline_assembly_library.sol#L24-L44)\n",
"first_markdown_element": "tests/detectors/assembly/0.6.11/inline_assembly_library.sol#L23-L45",
"id": "5964c7440a9efb78bf78544bcdc60c789e3d9dff73438108bcb07ac98d60876a",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
}
]
]

@ -0,0 +1,20 @@
// taken from https://solidity.readthedocs.io/en/v0.4.25/assembly.html
library GetCode {
function at(address _addr) public view returns (bytes memory o_code) {
assembly {
// retrieve the size of the code, this needs assembly
let size := extcodesize(_addr)
// allocate output byte array - this could also be done without assembly
// by using o_code = new bytes(size)
o_code := mload(0x40)
// new "memory end" including padding
mstore(0x40, add(o_code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
// store length in memory
mstore(o_code, size)
// actually retrieve the code, this needs assembly
extcodecopy(_addr, add(o_code, 0x20), 0, size)
}
}
}

@ -0,0 +1,185 @@
[
[
{
"elements": [
{
"type": "function",
"name": "at",
"source_mapping": {
"start": 94,
"length": 707,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "GetCode",
"source_mapping": {
"start": 72,
"length": 731,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "at(address)"
}
},
{
"type": "node",
"name": "",
"source_mapping": {
"start": 173,
"length": 622,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17
],
"starting_column": 9,
"ending_column": 10
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "at",
"source_mapping": {
"start": 94,
"length": 707,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "GetCode",
"source_mapping": {
"start": 72,
"length": 731,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol",
"is_dependency": false,
"lines": [
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "at(address)"
}
}
}
}
],
"description": "GetCode.at(address) (tests/detectors/assembly/0.7.6/inline_assembly_contract.sol#4-18) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.7.6/inline_assembly_contract.sol#5-17)\n",
"markdown": "[GetCode.at(address)](tests/detectors/assembly/0.7.6/inline_assembly_contract.sol#L4-L18) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.7.6/inline_assembly_contract.sol#L5-L17)\n",
"first_markdown_element": "tests/detectors/assembly/0.7.6/inline_assembly_contract.sol#L4-L18",
"id": "3b2ace4ab64f4fdd4436ae22d38a7db3efe8d2b65dca270af7fb18f281323670",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
}
]
]

@ -0,0 +1,47 @@
// taken from https://solidity.readthedocs.io/en/v0.4.25/assembly.html
library VectorSum {
// This function is less efficient because the optimizer currently fails to
// remove the bounds checks in array access.
function sumSolidity(uint[] memory _data) public view returns (uint o_sum) {
for (uint i = 0; i < _data.length; ++i)
o_sum += _data[i];
}
// We know that we only access the array in bounds, so we can avoid the check.
// 0x20 needs to be added to an array because the first slot contains the
// array length.
function sumAsm(uint[] memory _data) public view returns (uint o_sum) {
for (uint i = 0; i < _data.length; ++i) {
assembly {
o_sum := add(o_sum, mload(add(add(_data, 0x20), mul(i, 0x20))))
}
}
}
// Same as above, but accomplish the entire code within inline assembly.
function sumPureAsm(uint[] memory _data) public view returns (uint o_sum) {
assembly {
// Load the length (first 32 bytes)
let len := mload(_data)
// Skip over the length field.
//
// Keep temporary variable so it can be incremented in place.
//
// NOTE: incrementing _data would result in an unusable
// _data variable after this assembly block
let data := add(_data, 0x20)
// Iterate until the bound is not met.
for
{ let end := add(data, len) }
lt(data, end)
{ data := add(data, 0x20) }
{
o_sum := add(o_sum, mload(data))
}
}
}
}

@ -0,0 +1,472 @@
[
[
{
"elements": [
{
"type": "function",
"name": "sumAsm",
"source_mapping": {
"start": 574,
"length": 254,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18,
19,
20
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 72,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "sumAsm(uint256[])"
}
},
{
"type": "node",
"name": "",
"source_mapping": {
"start": 708,
"length": 104,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
16,
17,
18
],
"starting_column": 13,
"ending_column": 14
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "sumAsm",
"source_mapping": {
"start": 574,
"length": 254,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18,
19,
20
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 72,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "sumAsm(uint256[])"
}
}
}
}
],
"description": "VectorSum.sumAsm(uint256[]) (tests/detectors/assembly/0.7.6/inline_assembly_library.sol#14-20) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.7.6/inline_assembly_library.sol#16-18)\n",
"markdown": "[VectorSum.sumAsm(uint256[])](tests/detectors/assembly/0.7.6/inline_assembly_library.sol#L14-L20) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.7.6/inline_assembly_library.sol#L16-L18)\n",
"first_markdown_element": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol#L14-L20",
"id": "a83582beb2c0460617fa82fbdfc38a050004e285749b17141b63e8051062248b",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "sumPureAsm",
"source_mapping": {
"start": 911,
"length": 761,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 72,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "sumPureAsm(uint256[])"
}
},
{
"type": "node",
"name": "",
"source_mapping": {
"start": 995,
"length": 671,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44
],
"starting_column": 9,
"ending_column": 10
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "sumPureAsm",
"source_mapping": {
"start": 911,
"length": 761,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"is_dependency": false,
"lines": [
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VectorSum",
"source_mapping": {
"start": 72,
"length": 1602,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "sumPureAsm(uint256[])"
}
}
}
}
],
"description": "VectorSum.sumPureAsm(uint256[]) (tests/detectors/assembly/0.7.6/inline_assembly_library.sol#23-45) uses assembly\n\t- INLINE ASM (tests/detectors/assembly/0.7.6/inline_assembly_library.sol#24-44)\n",
"markdown": "[VectorSum.sumPureAsm(uint256[])](tests/detectors/assembly/0.7.6/inline_assembly_library.sol#L23-L45) uses assembly\n\t- [INLINE ASM](tests/detectors/assembly/0.7.6/inline_assembly_library.sol#L24-L44)\n",
"first_markdown_element": "tests/detectors/assembly/0.7.6/inline_assembly_library.sol#L23-L45",
"id": "5cafb3e9d7d87c17203cf2c296eeec7de6b774b2a8d71908f8cfc9b8d916cb4b",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
}
]
]

@ -0,0 +1,571 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad0",
"source_mapping": {
"start": 77,
"length": 57,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"lines": [
6,
7,
8
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad0()"
}
},
{
"type": "node",
"name": "assert(bool)((s_a += 1) > 10)",
"source_mapping": {
"start": 106,
"length": 23,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"lines": [
7
],
"starting_column": 5,
"ending_column": 28
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad0",
"source_mapping": {
"start": 77,
"length": 57,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"lines": [
6,
7,
8
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad0()"
}
}
}
}
],
"description": "A.bad0() (tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#6-8) has an assert() call which possibly changes state.\n\t-assert(bool)((s_a += 1) > 10) (tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#7)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad0()](tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#L6-L8) has an assert() call which possibly changes state.\n\t-[assert(bool)((s_a += 1) > 10)](tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#L7)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#L6-L8",
"id": "a01104ede08ddc5107a2d63d851930d477642029aeef70d6cb44eb2a640b282a",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 186,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
},
{
"type": "node",
"name": "assert(bool)((s_a += a) > 10)",
"source_mapping": {
"start": 224,
"length": 23,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"lines": [
12
],
"starting_column": 5,
"ending_column": 28
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 186,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
}
}
}
],
"description": "A.bad1(uint256) (tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#11-13) has an assert() call which possibly changes state.\n\t-assert(bool)((s_a += a) > 10) (tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#12)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad1(uint256)](tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#L11-L13) has an assert() call which possibly changes state.\n\t-[assert(bool)((s_a += a) > 10)](tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#L12)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#L11-L13",
"id": "849934acf882563bb79caed681f16909f03795bbbbe8338455d104d66a52314c",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 398,
"length": 55,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"lines": [
19,
20,
21
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
},
{
"type": "node",
"name": "assert(bool)(bad2_callee())",
"source_mapping": {
"start": 427,
"length": 21,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"lines": [
20
],
"starting_column": 5,
"ending_column": 26
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 398,
"length": 55,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"lines": [
19,
20,
21
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
}
}
}
],
"description": "A.bad2() (tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#19-21) has an assert() call which possibly changes state.\n\t-assert(bool)(bad2_callee()) (tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#20)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad2()](tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#L19-L21) has an assert() call which possibly changes state.\n\t-[assert(bool)(bad2_callee())](tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#L20)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.4.25/assert_state_change.sol#L19-L21",
"id": "47c8c39b084f8d339822d44f892cb049c1a3834f52fd48d2dcef80bac56996a3",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
}
]
]

@ -0,0 +1,39 @@
contract A {
uint s_a;
/* Direct state change in assert is NOT ok */
function bad0() public {
assert((s_a += 1) > 10);
}
/* Direct state change in assert is NOT ok */
function bad1(uint256 a) public {
assert((s_a += a) > 10);
}
/* State change via functions calls in assert is NOT ok */
function bad2_callee() public returns (bool) {
return (s_a += 1) > 10;
}
function bad2() public {
assert(bad2_callee());
}
/* Parameter use is ok */
function good0(uint256 a) public {
assert(a > 10);
}
/* Parameter change is ok */
function good1(uint256 a) public {
assert((a += 1) > 10);
}
/* State change in require is ok */
function good2(uint256 a) public {
require(a == (s_a += 1));
}
}

@ -0,0 +1,571 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad0",
"source_mapping": {
"start": 77,
"length": 57,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"lines": [
6,
7,
8
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad0()"
}
},
{
"type": "node",
"name": "assert(bool)((s_a += 1) > 10)",
"source_mapping": {
"start": 106,
"length": 23,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"lines": [
7
],
"starting_column": 5,
"ending_column": 28
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad0",
"source_mapping": {
"start": 77,
"length": 57,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"lines": [
6,
7,
8
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad0()"
}
}
}
}
],
"description": "A.bad0() (tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#6-8) has an assert() call which possibly changes state.\n\t-assert(bool)((s_a += 1) > 10) (tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#7)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad0()](tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#L6-L8) has an assert() call which possibly changes state.\n\t-[assert(bool)((s_a += 1) > 10)](tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#L7)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#L6-L8",
"id": "ed7344e23d057576887c7e524b215bd0b52464ce035f686bab51b271460e43a0",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 186,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
},
{
"type": "node",
"name": "assert(bool)((s_a += a) > 10)",
"source_mapping": {
"start": 224,
"length": 23,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"lines": [
12
],
"starting_column": 5,
"ending_column": 28
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 186,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
}
}
}
],
"description": "A.bad1(uint256) (tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#11-13) has an assert() call which possibly changes state.\n\t-assert(bool)((s_a += a) > 10) (tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#12)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad1(uint256)](tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#L11-L13) has an assert() call which possibly changes state.\n\t-[assert(bool)((s_a += a) > 10)](tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#L12)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#L11-L13",
"id": "ea912d34e8adabfd2ce93ecd5723df8d2e7ebec7e66de5fc56f3304c780488b3",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 398,
"length": 55,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"lines": [
19,
20,
21
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
},
{
"type": "node",
"name": "assert(bool)(bad2_callee())",
"source_mapping": {
"start": 427,
"length": 21,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"lines": [
20
],
"starting_column": 5,
"ending_column": 26
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 398,
"length": 55,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"lines": [
19,
20,
21
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
}
}
}
],
"description": "A.bad2() (tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#19-21) has an assert() call which possibly changes state.\n\t-assert(bool)(bad2_callee()) (tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#20)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad2()](tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#L19-L21) has an assert() call which possibly changes state.\n\t-[assert(bool)(bad2_callee())](tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#L20)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.5.16/assert_state_change.sol#L19-L21",
"id": "feb1fef411c094fe2d2dac33e4932217dd550b8a89548417ef8a4da2fe99eea2",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
}
]
]

@ -0,0 +1,39 @@
contract A {
uint s_a;
/* Direct state change in assert is NOT ok */
function bad0() public {
assert((s_a += 1) > 10);
}
/* Direct state change in assert is NOT ok */
function bad1(uint256 a) public {
assert((s_a += a) > 10);
}
/* State change via functions calls in assert is NOT ok */
function bad2_callee() public returns (bool) {
return (s_a += 1) > 10;
}
function bad2() public {
assert(bad2_callee());
}
/* Parameter use is ok */
function good0(uint256 a) public {
assert(a > 10);
}
/* Parameter change is ok */
function good1(uint256 a) public {
assert((a += 1) > 10);
}
/* State change in require is ok */
function good2(uint256 a) public {
require(a == (s_a += 1));
}
}

@ -0,0 +1,571 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad0",
"source_mapping": {
"start": 77,
"length": 57,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"lines": [
6,
7,
8
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad0()"
}
},
{
"type": "node",
"name": "assert(bool)((s_a += 1) > 10)",
"source_mapping": {
"start": 106,
"length": 23,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"lines": [
7
],
"starting_column": 5,
"ending_column": 28
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad0",
"source_mapping": {
"start": 77,
"length": 57,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"lines": [
6,
7,
8
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad0()"
}
}
}
}
],
"description": "A.bad0() (tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#6-8) has an assert() call which possibly changes state.\n\t-assert(bool)((s_a += 1) > 10) (tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#7)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad0()](tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#L6-L8) has an assert() call which possibly changes state.\n\t-[assert(bool)((s_a += 1) > 10)](tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#L7)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#L6-L8",
"id": "5b8574d24925d841b9f041ba70166cc219ea6bcdd06c27d2f570740722b38380",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 186,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
},
{
"type": "node",
"name": "assert(bool)((s_a += a) > 10)",
"source_mapping": {
"start": 224,
"length": 23,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"lines": [
12
],
"starting_column": 5,
"ending_column": 28
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 186,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
}
}
}
],
"description": "A.bad1(uint256) (tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#11-13) has an assert() call which possibly changes state.\n\t-assert(bool)((s_a += a) > 10) (tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#12)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad1(uint256)](tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#L11-L13) has an assert() call which possibly changes state.\n\t-[assert(bool)((s_a += a) > 10)](tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#L12)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#L11-L13",
"id": "c27ede68d9d7c6159032f3aef6bf9fa491390317da33307fa783a93c1b675bd7",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 398,
"length": 55,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"lines": [
19,
20,
21
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
},
{
"type": "node",
"name": "assert(bool)(bad2_callee())",
"source_mapping": {
"start": 427,
"length": 21,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"lines": [
20
],
"starting_column": 5,
"ending_column": 26
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 398,
"length": 55,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"lines": [
19,
20,
21
],
"starting_column": 3,
"ending_column": 4
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
}
}
}
],
"description": "A.bad2() (tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#19-21) has an assert() call which possibly changes state.\n\t-assert(bool)(bad2_callee()) (tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#20)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad2()](tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#L19-L21) has an assert() call which possibly changes state.\n\t-[assert(bool)(bad2_callee())](tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#L20)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.6.11/assert_state_change.sol#L19-L21",
"id": "6f4b2360043bf3035cc152b583d3462d8cc98e91de8577091fe3a0af569d5285",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
}
]
]

@ -0,0 +1,39 @@
contract A {
uint s_a;
/* Direct state change in assert is NOT ok */
function bad0() public {
assert((s_a += 1) > 10);
}
/* Direct state change in assert is NOT ok */
function bad1(uint256 a) public {
assert((s_a += a) > 10);
}
/* State change via functions calls in assert is NOT ok */
function bad2_callee() public returns (bool) {
return (s_a += 1) > 10;
}
function bad2() public {
assert(bad2_callee());
}
/* Parameter use is ok */
function good0(uint256 a) public {
assert(a > 10);
}
/* Parameter change is ok */
function good1(uint256 a) public {
assert((a += 1) > 10);
}
/* State change in require is ok */
function good2(uint256 a) public {
require(a == (s_a += 1));
}
}

@ -9,9 +9,9 @@
"start": 77,
"length": 57,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
6,
@ -29,9 +29,9 @@
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
1,
@ -88,9 +88,9 @@
"start": 106,
"length": 23,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
7
@ -106,9 +106,9 @@
"start": 77,
"length": 57,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
6,
@ -126,9 +126,9 @@
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
1,
@ -181,10 +181,10 @@
}
}
],
"description": "A.bad0() (tests/detectors/assert-state-change/assert_state_change.sol#6-8) has an assert() call which possibly changes state.\n\t-assert(bool)((s_a += 1) > 10) (tests/detectors/assert-state-change/assert_state_change.sol#7)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad0()](tests/detectors/assert-state-change/assert_state_change.sol#L6-L8) has an assert() call which possibly changes state.\n\t-[assert(bool)((s_a += 1) > 10)](tests/detectors/assert-state-change/assert_state_change.sol#L7)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/assert_state_change.sol#L6-L8",
"id": "a4f5ea904ad28f8c83aa1bab8284b485e1fe638545b500ca0c8a0fa8e442203e",
"description": "A.bad0() (tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#6-8) has an assert() call which possibly changes state.\n\t-assert(bool)((s_a += 1) > 10) (tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#7)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad0()](tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#L6-L8) has an assert() call which possibly changes state.\n\t-[assert(bool)((s_a += 1) > 10)](tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#L7)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#L6-L8",
"id": "a710d11e5510f0eb3acb2c1ec524779253f25bf2931bce4cb9c5c048ec586b80",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
@ -198,9 +198,9 @@
"start": 186,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
11,
@ -218,9 +218,9 @@
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
1,
@ -277,9 +277,9 @@
"start": 224,
"length": 23,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
12
@ -295,9 +295,9 @@
"start": 186,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
11,
@ -315,9 +315,9 @@
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
1,
@ -370,10 +370,10 @@
}
}
],
"description": "A.bad1(uint256) (tests/detectors/assert-state-change/assert_state_change.sol#11-13) has an assert() call which possibly changes state.\n\t-assert(bool)((s_a += a) > 10) (tests/detectors/assert-state-change/assert_state_change.sol#12)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad1(uint256)](tests/detectors/assert-state-change/assert_state_change.sol#L11-L13) has an assert() call which possibly changes state.\n\t-[assert(bool)((s_a += a) > 10)](tests/detectors/assert-state-change/assert_state_change.sol#L12)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/assert_state_change.sol#L11-L13",
"id": "2b42e9f701ebd94656a026702bf90f31c62710a301600e0c05cfed04bfefabf9",
"description": "A.bad1(uint256) (tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#11-13) has an assert() call which possibly changes state.\n\t-assert(bool)((s_a += a) > 10) (tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#12)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad1(uint256)](tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#L11-L13) has an assert() call which possibly changes state.\n\t-[assert(bool)((s_a += a) > 10)](tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#L12)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#L11-L13",
"id": "60ad080e2f9647b400851918171383a9aac2900cc0828121e441db4240911fba",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
@ -387,9 +387,9 @@
"start": 398,
"length": 55,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
19,
@ -407,9 +407,9 @@
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
1,
@ -466,9 +466,9 @@
"start": 427,
"length": 21,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
20
@ -484,9 +484,9 @@
"start": 398,
"length": 55,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
19,
@ -504,9 +504,9 @@
"start": 0,
"length": 759,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_relative": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/assert-state-change/assert_state_change.sol",
"filename_short": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol",
"is_dependency": false,
"lines": [
1,
@ -559,10 +559,10 @@
}
}
],
"description": "A.bad2() (tests/detectors/assert-state-change/assert_state_change.sol#19-21) has an assert() call which possibly changes state.\n\t-assert(bool)(bad2_callee()) (tests/detectors/assert-state-change/assert_state_change.sol#20)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad2()](tests/detectors/assert-state-change/assert_state_change.sol#L19-L21) has an assert() call which possibly changes state.\n\t-[assert(bool)(bad2_callee())](tests/detectors/assert-state-change/assert_state_change.sol#L20)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/assert_state_change.sol#L19-L21",
"id": "a72f3e7eef408be55123fbf5c290bfd20aed4f095d659f5df0857d64d61df011",
"description": "A.bad2() (tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#19-21) has an assert() call which possibly changes state.\n\t-assert(bool)(bad2_callee()) (tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#20)\nConsider using require() or change the invariant to not modify the state.\n",
"markdown": "[A.bad2()](tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#L19-L21) has an assert() call which possibly changes state.\n\t-[assert(bool)(bad2_callee())](tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#L20)\nConsider using require() or change the invariant to not modify the state.\n",
"first_markdown_element": "tests/detectors/assert-state-change/0.7.6/assert_state_change.sol#L19-L21",
"id": "4b31923b05dec7d68f1bf133b986b4ec06fcc82ff3b8f0414d3ee3d623b69265",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"

@ -9,9 +9,9 @@
"start": 18,
"length": 74,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/backdoor.sol",
"filename_relative": "tests/detectors/backdoor/0.4.25/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/backdoor.sol",
"filename_short": "tests/detectors/backdoor/0.4.25/backdoor.sol",
"is_dependency": false,
"lines": [
4,
@ -29,9 +29,9 @@
"start": 1,
"length": 94,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/backdoor.sol",
"filename_relative": "tests/detectors/backdoor/0.4.25/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/backdoor.sol",
"filename_short": "tests/detectors/backdoor/0.4.25/backdoor.sol",
"is_dependency": false,
"lines": [
2,
@ -50,9 +50,9 @@
}
}
],
"description": "Backdoor function found in C.i_am_a_backdoor() (tests/detectors/backdoor/backdoor.sol#4-6)\n",
"markdown": "Backdoor function found in [C.i_am_a_backdoor()](tests/detectors/backdoor/backdoor.sol#L4-L6)\n",
"first_markdown_element": "tests/detectors/backdoor/backdoor.sol#L4-L6",
"description": "Backdoor function found in C.i_am_a_backdoor() (tests/detectors/backdoor/0.4.25/backdoor.sol#4-6)\n",
"markdown": "Backdoor function found in [C.i_am_a_backdoor()](tests/detectors/backdoor/0.4.25/backdoor.sol#L4-L6)\n",
"first_markdown_element": "tests/detectors/backdoor/0.4.25/backdoor.sol#L4-L6",
"id": "8a9008f2f5cd23b34feb0235dcc30ecb8d09a10eff151b522939caead117ef7a",
"check": "backdoor",
"impact": "High",

@ -0,0 +1,8 @@
contract C{
function i_am_a_backdoor() public{
selfdestruct(msg.sender);
}
}

@ -9,9 +9,9 @@
"start": 18,
"length": 74,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/backdoor.sol",
"filename_relative": "tests/detectors/backdoor/0.5.16/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/backdoor.sol",
"filename_short": "tests/detectors/backdoor/0.5.16/backdoor.sol",
"is_dependency": false,
"lines": [
4,
@ -29,9 +29,9 @@
"start": 1,
"length": 94,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/backdoor.sol",
"filename_relative": "tests/detectors/backdoor/0.5.16/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/backdoor.sol",
"filename_short": "tests/detectors/backdoor/0.5.16/backdoor.sol",
"is_dependency": false,
"lines": [
2,
@ -50,11 +50,11 @@
}
}
],
"description": "C.i_am_a_backdoor() (tests/detectors/backdoor/backdoor.sol#4-6) allows anyone to destruct the contract\n",
"markdown": "[C.i_am_a_backdoor()](tests/detectors/backdoor/backdoor.sol#L4-L6) allows anyone to destruct the contract\n",
"first_markdown_element": "tests/detectors/backdoor/backdoor.sol#L4-L6",
"id": "bb1e4596537b6e2c29f4221e733692fd6dac8555095181718e440ca525016eb7",
"check": "suicidal",
"description": "Backdoor function found in C.i_am_a_backdoor() (tests/detectors/backdoor/0.5.16/backdoor.sol#4-6)\n",
"markdown": "Backdoor function found in [C.i_am_a_backdoor()](tests/detectors/backdoor/0.5.16/backdoor.sol#L4-L6)\n",
"first_markdown_element": "tests/detectors/backdoor/0.5.16/backdoor.sol#L4-L6",
"id": "8a9008f2f5cd23b34feb0235dcc30ecb8d09a10eff151b522939caead117ef7a",
"check": "backdoor",
"impact": "High",
"confidence": "High"
}

@ -0,0 +1,8 @@
contract C{
function i_am_a_backdoor() public{
selfdestruct(msg.sender);
}
}

@ -9,9 +9,9 @@
"start": 18,
"length": 74,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/backdoor.sol",
"filename_relative": "tests/detectors/backdoor/0.6.11/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/backdoor.sol",
"filename_short": "tests/detectors/backdoor/0.6.11/backdoor.sol",
"is_dependency": false,
"lines": [
4,
@ -29,9 +29,9 @@
"start": 1,
"length": 94,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/backdoor.sol",
"filename_relative": "tests/detectors/backdoor/0.6.11/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/backdoor.sol",
"filename_short": "tests/detectors/backdoor/0.6.11/backdoor.sol",
"is_dependency": false,
"lines": [
2,
@ -50,11 +50,11 @@
}
}
],
"description": "C.i_am_a_backdoor() (tests/detectors/backdoor/backdoor.sol#4-6) allows anyone to destruct the contract\n",
"markdown": "[C.i_am_a_backdoor()](tests/detectors/backdoor/backdoor.sol#L4-L6) allows anyone to destruct the contract\n",
"first_markdown_element": "tests/detectors/backdoor/backdoor.sol#L4-L6",
"id": "bb1e4596537b6e2c29f4221e733692fd6dac8555095181718e440ca525016eb7",
"check": "suicidal",
"description": "Backdoor function found in C.i_am_a_backdoor() (tests/detectors/backdoor/0.6.11/backdoor.sol#4-6)\n",
"markdown": "Backdoor function found in [C.i_am_a_backdoor()](tests/detectors/backdoor/0.6.11/backdoor.sol#L4-L6)\n",
"first_markdown_element": "tests/detectors/backdoor/0.6.11/backdoor.sol#L4-L6",
"id": "8a9008f2f5cd23b34feb0235dcc30ecb8d09a10eff151b522939caead117ef7a",
"check": "backdoor",
"impact": "High",
"confidence": "High"
}

@ -0,0 +1,8 @@
contract C{
function i_am_a_backdoor() public{
selfdestruct(msg.sender);
}
}

@ -9,9 +9,9 @@
"start": 18,
"length": 74,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/backdoor.sol",
"filename_relative": "tests/detectors/backdoor/0.7.6/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/backdoor.sol",
"filename_short": "tests/detectors/backdoor/0.7.6/backdoor.sol",
"is_dependency": false,
"lines": [
4,
@ -29,9 +29,9 @@
"start": 1,
"length": 94,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/backdoor.sol",
"filename_relative": "tests/detectors/backdoor/0.7.6/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/backdoor.sol",
"filename_short": "tests/detectors/backdoor/0.7.6/backdoor.sol",
"is_dependency": false,
"lines": [
2,
@ -50,9 +50,9 @@
}
}
],
"description": "Backdoor function found in C.i_am_a_backdoor() (tests/detectors/backdoor/backdoor.sol#4-6)\n",
"markdown": "Backdoor function found in [C.i_am_a_backdoor()](tests/detectors/backdoor/backdoor.sol#L4-L6)\n",
"first_markdown_element": "tests/detectors/backdoor/backdoor.sol#L4-L6",
"description": "Backdoor function found in C.i_am_a_backdoor() (tests/detectors/backdoor/0.7.6/backdoor.sol#4-6)\n",
"markdown": "Backdoor function found in [C.i_am_a_backdoor()](tests/detectors/backdoor/0.7.6/backdoor.sol#L4-L6)\n",
"first_markdown_element": "tests/detectors/backdoor/0.7.6/backdoor.sol#L4-L6",
"id": "8a9008f2f5cd23b34feb0235dcc30ecb8d09a10eff151b522939caead117ef7a",
"check": "backdoor",
"impact": "High",

@ -9,9 +9,9 @@
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_relative": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_short": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
9,
@ -29,9 +29,9 @@
"start": 0,
"length": 923,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_relative": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_short": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
1,
@ -96,9 +96,9 @@
"start": 221,
"length": 18,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_relative": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_short": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
10
@ -114,9 +114,9 @@
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_relative": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_short": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
9,
@ -134,9 +134,9 @@
"start": 0,
"length": 923,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_relative": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_short": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
1,
@ -197,10 +197,10 @@
}
}
],
"description": "MyConc.bad1(bool) (tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol#9-11) uses a Boolean constant improperly:\n\t-(b || true) (tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol#10)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol#L9-L11) uses a Boolean constant improperly:\n\t-[(b || true)](tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol#L10)\n",
"first_markdown_element": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol#L9-L11",
"id": "12517fed0ec8f0a2232b467a6add9fd94a6a84325017e02e8a48794fc9112c6b",
"description": "MyConc.bad1(bool) (tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol#9-11) uses a Boolean constant improperly:\n\t-(b || true) (tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol#10)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol#L9-L11) uses a Boolean constant improperly:\n\t-[(b || true)](tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol#L10)\n",
"first_markdown_element": "tests/detectors/boolean-cst/0.4.25/boolean-constant-misuse.sol#L9-L11",
"id": "4b8abd9aa6870f3044de67a84b3139e4a79c9ac13b4c0ed4f0772713f12c709b",
"check": "boolean-cst",
"impact": "Medium",
"confidence": "Medium"

@ -0,0 +1,46 @@
contract MyConc {
function bad0(bool foo) public pure returns (bool) {
if (foo) {
return true;
}
return false;
}
function bad1(bool b) public pure returns (bool) {
return (b || true);
}
function bad2(bool x, uint8 y) public pure returns (bool) {
while (x == (y > 0)) {
return true;
}
return false;
}
function bad3(bool a) public pure returns (bool) {
uint256 b = 0;
while (a) {
b++;
}
return true;
}
function bad4() public pure returns (bool) {
uint256 b = 0;
while (true) {
b++;
}
return true;
}
function bad5() public pure returns (bool) {
while (true) {
return true;
}
return false;
}
function good() public pure returns (bool) {
return true;
}
}

@ -4,19 +4,19 @@
"elements": [
{
"type": "function",
"name": "bad0",
"name": "bad1",
"source_mapping": {
"start": 1737,
"length": 49,
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/unused-return/unused_return-sol7.sol",
"filename_relative": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/unused-return/unused_return-sol7.sol",
"filename_short": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
60,
61,
62
9,
10,
11
],
"starting_column": 5,
"ending_column": 6
@ -24,16 +24,27 @@
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "C",
"name": "MyConc",
"source_mapping": {
"start": 330,
"length": 1818,
"start": 0,
"length": 923,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/unused-return/unused_return-sol7.sol",
"filename_relative": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/unused-return/unused_return-sol7.sol",
"filename_short": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
@ -69,80 +80,48 @@
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,
73,
74,
75,
76,
77,
78,
79
47
],
"starting_column": 1,
"ending_column": 0
}
},
"signature": "bad0()"
"signature": "bad1(bool)"
}
},
{
"type": "node",
"name": "t.other()",
"name": "(b || true)",
"source_mapping": {
"start": 1770,
"length": 9,
"start": 221,
"length": 18,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/unused-return/unused_return-sol7.sol",
"filename_relative": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/unused-return/unused_return-sol7.sol",
"filename_short": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
61
10
],
"starting_column": 9,
"ending_column": 18
"ending_column": 27
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad0",
"name": "bad1",
"source_mapping": {
"start": 1737,
"length": 49,
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/unused-return/unused_return-sol7.sol",
"filename_relative": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/unused-return/unused_return-sol7.sol",
"filename_short": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
60,
61,
62
9,
10,
11
],
"starting_column": 5,
"ending_column": 6
@ -150,16 +129,27 @@
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "C",
"name": "MyConc",
"source_mapping": {
"start": 330,
"length": 1818,
"start": 0,
"length": 923,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/unused-return/unused_return-sol7.sol",
"filename_relative": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/unused-return/unused_return-sol7.sol",
"filename_short": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
@ -195,55 +185,23 @@
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,
73,
74,
75,
76,
77,
78,
79
47
],
"starting_column": 1,
"ending_column": 0
}
},
"signature": "bad0()"
"signature": "bad1(bool)"
}
}
}
}
],
"description": "C.bad0() (tests/detectors/unused-return/unused_return-sol7.sol#60-62) ignores return value by t.other() (tests/detectors/unused-return/unused_return-sol7.sol#61)\n",
"markdown": "[C.bad0()](tests/detectors/unused-return/unused_return-sol7.sol#L60-L62) ignores return value by [t.other()](tests/detectors/unused-return/unused_return-sol7.sol#L61)\n",
"first_markdown_element": "tests/detectors/unused-return/unused_return-sol7.sol#L60-L62",
"id": "f9924f5b012de6c1e91b68996bc7944585b0daab740b86c89cd157b0d22d0092",
"check": "unused-return",
"description": "MyConc.bad1(bool) (tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol#9-11) uses a Boolean constant improperly:\n\t-(b || true) (tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol#10)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol#L9-L11) uses a Boolean constant improperly:\n\t-[(b || true)](tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol#L10)\n",
"first_markdown_element": "tests/detectors/boolean-cst/0.5.16/boolean-constant-misuse.sol#L9-L11",
"id": "bd4514763d71bc7fcb2a681b1fe98928e9d1dd92882c5fe0480e52cba9130cfe",
"check": "boolean-cst",
"impact": "Medium",
"confidence": "Medium"
}

@ -0,0 +1,46 @@
contract MyConc {
function bad0(bool foo) public pure returns (bool) {
if (foo) {
return true;
}
return false;
}
function bad1(bool b) public pure returns (bool) {
return (b || true);
}
function bad2(bool x, uint8 y) public pure returns (bool) {
while (x == (y > 0)) {
return true;
}
return false;
}
function bad3(bool a) public pure returns (bool) {
uint256 b = 0;
while (a) {
b++;
}
return true;
}
function bad4() public pure returns (bool) {
uint256 b = 0;
while (true) {
b++;
}
return true;
}
function bad5() public pure returns (bool) {
while (true) {
return true;
}
return false;
}
function good() public pure returns (bool) {
return true;
}
}

@ -0,0 +1,209 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
9,
10,
11
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 0,
"length": 923,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol",
"is_dependency": false,
"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,
42,
43,
44,
45,
46,
47
],
"starting_column": 1,
"ending_column": 0
}
},
"signature": "bad1(bool)"
}
},
{
"type": "node",
"name": "(b || true)",
"source_mapping": {
"start": 221,
"length": 18,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
10
],
"starting_column": 9,
"ending_column": 27
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
9,
10,
11
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 0,
"length": 923,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol",
"is_dependency": false,
"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,
42,
43,
44,
45,
46,
47
],
"starting_column": 1,
"ending_column": 0
}
},
"signature": "bad1(bool)"
}
}
}
}
],
"description": "MyConc.bad1(bool) (tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol#9-11) uses a Boolean constant improperly:\n\t-(b || true) (tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol#10)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol#L9-L11) uses a Boolean constant improperly:\n\t-[(b || true)](tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol#L10)\n",
"first_markdown_element": "tests/detectors/boolean-cst/0.6.11/boolean-constant-misuse.sol#L9-L11",
"id": "81067a443028f22790f44718bff947b7ec6de12b929bd89147d3b34044b3890d",
"check": "boolean-cst",
"impact": "Medium",
"confidence": "Medium"
}
]
]

@ -0,0 +1,46 @@
contract MyConc {
function bad0(bool foo) public pure returns (bool) {
if (foo) {
return true;
}
return false;
}
function bad1(bool b) public pure returns (bool) {
return (b || true);
}
function bad2(bool x, uint8 y) public pure returns (bool) {
while (x == (y > 0)) {
return true;
}
return false;
}
function bad3(bool a) public pure returns (bool) {
uint256 b = 0;
while (a) {
b++;
}
return true;
}
function bad4() public pure returns (bool) {
uint256 b = 0;
while (true) {
b++;
}
return true;
}
function bad5() public pure returns (bool) {
while (true) {
return true;
}
return false;
}
function good() public pure returns (bool) {
return true;
}
}

@ -0,0 +1,209 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
9,
10,
11
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 0,
"length": 923,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol",
"is_dependency": false,
"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,
42,
43,
44,
45,
46,
47
],
"starting_column": 1,
"ending_column": 0
}
},
"signature": "bad1(bool)"
}
},
{
"type": "node",
"name": "(b || true)",
"source_mapping": {
"start": 221,
"length": 18,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
10
],
"starting_column": 9,
"ending_column": 27
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
9,
10,
11
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 0,
"length": 923,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol",
"is_dependency": false,
"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,
42,
43,
44,
45,
46,
47
],
"starting_column": 1,
"ending_column": 0
}
},
"signature": "bad1(bool)"
}
}
}
}
],
"description": "MyConc.bad1(bool) (tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol#9-11) uses a Boolean constant improperly:\n\t-(b || true) (tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol#10)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol#L9-L11) uses a Boolean constant improperly:\n\t-[(b || true)](tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol#L10)\n",
"first_markdown_element": "tests/detectors/boolean-cst/0.7.6/boolean-constant-misuse.sol#L9-L11",
"id": "d96572f8601700902d157c2b4ad0b66254eba7a6d9c83710f26ea8cbdf2085fa",
"check": "boolean-cst",
"impact": "Medium",
"confidence": "Medium"
}
]
]

@ -9,9 +9,9 @@
"start": 139,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol",
"filename_relative": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol",
"filename_short": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
7,
@ -29,9 +29,9 @@
"start": 0,
"length": 578,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol",
"filename_relative": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol",
"filename_short": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
1,
@ -77,9 +77,9 @@
"start": 198,
"length": 18,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol",
"filename_relative": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol",
"filename_short": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
8
@ -95,9 +95,9 @@
"start": 139,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol",
"filename_relative": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol",
"filename_short": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
7,
@ -115,9 +115,9 @@
"start": 0,
"length": 578,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol",
"filename_relative": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol",
"filename_short": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
1,
@ -159,10 +159,10 @@
}
}
],
"description": "MyConc.bad1(bool) (tests/detectors/boolean-constant-equality/boolean-constant-equality.sol#7-9) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-constant-equality/boolean-constant-equality.sol#8)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-equality/boolean-constant-equality.sol#L7-L9) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-constant-equality/boolean-constant-equality.sol#L8)\n",
"first_markdown_element": "tests/detectors/boolean-constant-equality/boolean-constant-equality.sol#L7-L9",
"id": "4a53e773c88b730f07c2e4106545df03b44679c56ee0d9dbd75dca010320e69c",
"description": "MyConc.bad1(bool) (tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol#7-9) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol#8)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol#L7-L9) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol#L8)\n",
"first_markdown_element": "tests/detectors/boolean-equal/0.4.25/boolean-constant-equality.sol#L7-L9",
"id": "55ba7d7edfd3cc9012d1fbd9d2ba12a488d950a885c3664fe080b90288a2c715",
"check": "boolean-equal",
"impact": "Informational",
"confidence": "High"

@ -0,0 +1,27 @@
contract MyConc {
function bad0(bool foo) public pure returns (bool) {
if (foo) {
return true;
}
}
function bad1(bool b) public pure returns (bool) {
return (b == true);
}
function bad2(bool x, uint8 y) public pure returns (bool) {
if (x == (y > 0)) {
return true;
}
}
function bad3() public pure returns (bool) {
uint256 a;
if (a == 10) {
return true;
}
}
function good(uint8 a) public pure returns (bool) {
return a >= 1;
}
}

@ -0,0 +1,171 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 139,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
7,
8,
9
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 0,
"length": 578,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 0
}
},
"signature": "bad1(bool)"
}
},
{
"type": "node",
"name": "(b == true)",
"source_mapping": {
"start": 198,
"length": 18,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
8
],
"starting_column": 9,
"ending_column": 27
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 139,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
7,
8,
9
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 0,
"length": 578,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 0
}
},
"signature": "bad1(bool)"
}
}
}
}
],
"description": "MyConc.bad1(bool) (tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol#7-9) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol#8)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol#L7-L9) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol#L8)\n",
"first_markdown_element": "tests/detectors/boolean-equal/0.5.16/boolean-constant-equality.sol#L7-L9",
"id": "be01fe651d102dc47ca3eb623ba9078138896f662948665b8d4e03780305c085",
"check": "boolean-equal",
"impact": "Informational",
"confidence": "High"
}
]
]

@ -0,0 +1,27 @@
contract MyConc {
function bad0(bool foo) public pure returns (bool) {
if (foo) {
return true;
}
}
function bad1(bool b) public pure returns (bool) {
return (b == true);
}
function bad2(bool x, uint8 y) public pure returns (bool) {
if (x == (y > 0)) {
return true;
}
}
function bad3() public pure returns (bool) {
uint256 a;
if (a == 10) {
return true;
}
}
function good(uint8 a) public pure returns (bool) {
return a >= 1;
}
}

@ -0,0 +1,171 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 139,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
7,
8,
9
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 0,
"length": 578,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 0
}
},
"signature": "bad1(bool)"
}
},
{
"type": "node",
"name": "(b == true)",
"source_mapping": {
"start": 198,
"length": 18,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
8
],
"starting_column": 9,
"ending_column": 27
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 139,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
7,
8,
9
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 0,
"length": 578,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol",
"is_dependency": false,
"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
],
"starting_column": 1,
"ending_column": 0
}
},
"signature": "bad1(bool)"
}
}
}
}
],
"description": "MyConc.bad1(bool) (tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol#7-9) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol#8)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol#L7-L9) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol#L8)\n",
"first_markdown_element": "tests/detectors/boolean-equal/0.6.11/boolean-constant-equality.sol#L7-L9",
"id": "0f863694c7b456673256b0f8002c9ac9f050b89b9ec3c86936c6399b3eb4b2e1",
"check": "boolean-equal",
"impact": "Informational",
"confidence": "High"
}
]
]

@ -0,0 +1,27 @@
contract MyConc {
function bad0(bool foo) public pure returns (bool) {
if (foo) {
return true;
}
}
function bad1(bool b) public pure returns (bool) {
return (b == true);
}
function bad2(bool x, uint8 y) public pure returns (bool) {
if (x == (y > 0)) {
return true;
}
}
function bad3() public pure returns (bool) {
uint256 a;
if (a == 10) {
return true;
}
}
function good(uint8 a) public pure returns (bool) {
return a >= 1;
}
}

@ -6,17 +6,17 @@
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 134,
"start": 139,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equality/boolean-equality.sol",
"filename_relative": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equality/boolean-equality.sol",
"filename_short": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
7,
8,
9,
10
9
],
"starting_column": 5,
"ending_column": 6
@ -27,11 +27,11 @@
"name": "MyConc",
"source_mapping": {
"start": 0,
"length": 573,
"length": 578,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equality/boolean-equality.sol",
"filename_relative": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equality/boolean-equality.sol",
"filename_short": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
1,
@ -60,10 +60,11 @@
24,
25,
26,
27
27,
28
],
"starting_column": 1,
"ending_column": 2
"ending_column": 0
}
},
"signature": "bad1(bool)"
@ -73,15 +74,15 @@
"type": "node",
"name": "(b == true)",
"source_mapping": {
"start": 193,
"start": 198,
"length": 18,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equality/boolean-equality.sol",
"filename_relative": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equality/boolean-equality.sol",
"filename_short": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
9
8
],
"starting_column": 9,
"ending_column": 27
@ -91,17 +92,17 @@
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 134,
"start": 139,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equality/boolean-equality.sol",
"filename_relative": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equality/boolean-equality.sol",
"filename_short": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
7,
8,
9,
10
9
],
"starting_column": 5,
"ending_column": 6
@ -112,11 +113,11 @@
"name": "MyConc",
"source_mapping": {
"start": 0,
"length": 573,
"length": 578,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-equality/boolean-equality.sol",
"filename_relative": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-equality/boolean-equality.sol",
"filename_short": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
1,
@ -145,10 +146,11 @@
24,
25,
26,
27
27,
28
],
"starting_column": 1,
"ending_column": 2
"ending_column": 0
}
},
"signature": "bad1(bool)"
@ -157,9 +159,10 @@
}
}
],
"description": "MyConc.bad1(bool) (tests/detectors/boolean-equality/boolean-equality.sol#8-10) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-equality/boolean-equality.sol#9)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-equality/boolean-equality.sol#L8-L10) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-equality/boolean-equality.sol#L9)\n",
"id": "62abb2589dfdb591044c10941ebc076ca56579e64bb3076c82c3acc761805495",
"description": "MyConc.bad1(bool) (tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol#7-9) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol#8)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol#L7-L9) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol#L8)\n",
"first_markdown_element": "tests/detectors/boolean-equal/0.7.6/boolean-constant-equality.sol#L7-L9",
"id": "7c89c8f828e73eb875b8f06bb1404ed2271cc5806f167d621604c23f62705f60",
"check": "boolean-equal",
"impact": "Informational",
"confidence": "High"

@ -9,9 +9,9 @@
"start": 153,
"length": 135,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/multiple_calls_in_loop.sol",
"filename_relative": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/multiple_calls_in_loop.sol",
"filename_short": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
9,
@ -31,9 +31,9 @@
"start": 0,
"length": 291,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/multiple_calls_in_loop.sol",
"filename_relative": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/multiple_calls_in_loop.sol",
"filename_short": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
1,
@ -66,9 +66,9 @@
"start": 244,
"length": 27,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/multiple_calls_in_loop.sol",
"filename_relative": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/multiple_calls_in_loop.sol",
"filename_short": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
11
@ -84,9 +84,9 @@
"start": 153,
"length": 135,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/multiple_calls_in_loop.sol",
"filename_relative": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/multiple_calls_in_loop.sol",
"filename_short": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
9,
@ -106,9 +106,9 @@
"start": 0,
"length": 291,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/multiple_calls_in_loop.sol",
"filename_relative": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/multiple_calls_in_loop.sol",
"filename_short": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
1,
@ -137,10 +137,10 @@
}
}
],
"description": "CallInLoop.bad() (tests/detectors/calls-loop/multiple_calls_in_loop.sol#9-13) has external calls inside a loop: destinations[i].transfer(i) (tests/detectors/calls-loop/multiple_calls_in_loop.sol#11)\n",
"markdown": "[CallInLoop.bad()](tests/detectors/calls-loop/multiple_calls_in_loop.sol#L9-L13) has external calls inside a loop: [destinations[i].transfer(i)](tests/detectors/calls-loop/multiple_calls_in_loop.sol#L11)\n",
"first_markdown_element": "tests/detectors/calls-loop/multiple_calls_in_loop.sol#L9-L13",
"id": "b5ddb0f2f8ab2160ca8a3f429672693f7a82cb9c5b69c571aa114385b13005e7",
"description": "CallInLoop.bad() (tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol#9-13) has external calls inside a loop: destinations[i].transfer(i) (tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol#11)\n",
"markdown": "[CallInLoop.bad()](tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol#L9-L13) has external calls inside a loop: [destinations[i].transfer(i)](tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol#L11)\n",
"first_markdown_element": "tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol#L9-L13",
"id": "997dd7de40b82c6ac8e98324329bd99f827ed067c22d5b508b2e56c87ad49c0a",
"check": "calls-loop",
"impact": "Low",
"confidence": "Medium"

@ -0,0 +1,15 @@
contract CallInLoop{
address[] destinations;
constructor(address[] memory newDestinations) public{
destinations = newDestinations;
}
function bad() external{
for (uint i=0; i < destinations.length; i++){
address(uint160(destinations[i])).transfer(i);
}
}
}

@ -0,0 +1,149 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad",
"source_mapping": {
"start": 160,
"length": 153,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
9,
10,
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "CallInLoop",
"source_mapping": {
"start": 0,
"length": 316,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad()"
}
},
{
"type": "node",
"name": "address(uint160(destinations[i])).transfer(i)",
"source_mapping": {
"start": 251,
"length": 45,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
11
],
"starting_column": 13,
"ending_column": 58
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad",
"source_mapping": {
"start": 160,
"length": 153,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
9,
10,
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "CallInLoop",
"source_mapping": {
"start": 0,
"length": 316,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad()"
}
}
}
}
],
"description": "CallInLoop.bad() (tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol#9-13) has external calls inside a loop: address(uint160(destinations[i])).transfer(i) (tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol#11)\n",
"markdown": "[CallInLoop.bad()](tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol#L9-L13) has external calls inside a loop: [address(uint160(destinations[i])).transfer(i)](tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol#L11)\n",
"first_markdown_element": "tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol#L9-L13",
"id": "47b82a76ee810d93f014f425eefea8adbb806036dfee401a9883b1aa3ca85c44",
"check": "calls-loop",
"impact": "Low",
"confidence": "Medium"
}
]
]

@ -0,0 +1,15 @@
contract CallInLoop{
address[] destinations;
constructor(address[] memory newDestinations) public{
destinations = newDestinations;
}
function bad() external{
for (uint i=0; i < destinations.length; i++){
address(uint160(destinations[i])).transfer(i);
}
}
}

@ -0,0 +1,149 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad",
"source_mapping": {
"start": 160,
"length": 153,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
9,
10,
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "CallInLoop",
"source_mapping": {
"start": 0,
"length": 316,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad()"
}
},
{
"type": "node",
"name": "address(uint160(destinations[i])).transfer(i)",
"source_mapping": {
"start": 251,
"length": 45,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
11
],
"starting_column": 13,
"ending_column": 58
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad",
"source_mapping": {
"start": 160,
"length": 153,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
9,
10,
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "CallInLoop",
"source_mapping": {
"start": 0,
"length": 316,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad()"
}
}
}
}
],
"description": "CallInLoop.bad() (tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol#9-13) has external calls inside a loop: address(uint160(destinations[i])).transfer(i) (tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol#11)\n",
"markdown": "[CallInLoop.bad()](tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol#L9-L13) has external calls inside a loop: [address(uint160(destinations[i])).transfer(i)](tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol#L11)\n",
"first_markdown_element": "tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol#L9-L13",
"id": "f7fa2b373fe4eb9207d3ed267d99d7ca34ec7d786898816bc113c3e20079a411",
"check": "calls-loop",
"impact": "Low",
"confidence": "Medium"
}
]
]

@ -0,0 +1,15 @@
contract CallInLoop{
address[] destinations;
constructor(address[] memory newDestinations) public{
destinations = newDestinations;
}
function bad() external{
for (uint i=0; i < destinations.length; i++){
address(uint160(destinations[i])).transfer(i);
}
}
}

@ -0,0 +1,149 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad",
"source_mapping": {
"start": 160,
"length": 153,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
9,
10,
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "CallInLoop",
"source_mapping": {
"start": 0,
"length": 316,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad()"
}
},
{
"type": "node",
"name": "address(uint160(destinations[i])).transfer(i)",
"source_mapping": {
"start": 251,
"length": 45,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
11
],
"starting_column": 13,
"ending_column": 58
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad",
"source_mapping": {
"start": 160,
"length": 153,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
9,
10,
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "CallInLoop",
"source_mapping": {
"start": 0,
"length": 316,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol",
"is_dependency": false,
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad()"
}
}
}
}
],
"description": "CallInLoop.bad() (tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol#9-13) has external calls inside a loop: address(uint160(destinations[i])).transfer(i) (tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol#11)\n",
"markdown": "[CallInLoop.bad()](tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol#L9-L13) has external calls inside a loop: [address(uint160(destinations[i])).transfer(i)](tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol#L11)\n",
"first_markdown_element": "tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol#L9-L13",
"id": "c06ed4f7f79cddc5fbc2f828500766cab0a6d18b262a0f8e9c227cef7e6607df",
"check": "calls-loop",
"impact": "Low",
"confidence": "Medium"
}
]
]

@ -9,9 +9,9 @@
"start": 132,
"length": 76,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
7
@ -27,9 +27,9 @@
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
@ -58,9 +58,9 @@
}
}
],
"description": "A.myFriendsAddress (tests/detectors/constable-states/const_state_variables.sol#7) should be constant\n",
"markdown": "[A.myFriendsAddress](tests/detectors/constable-states/const_state_variables.sol#L7) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L7",
"description": "A.myFriendsAddress (tests/detectors/constable-states/0.4.25/const_state_variables.sol#7) should be constant\n",
"markdown": "[A.myFriendsAddress](tests/detectors/constable-states/0.4.25/const_state_variables.sol#L7) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.4.25/const_state_variables.sol#L7",
"id": "1454db80653b732bf6acbe54ff0ae4707002207a2a8216708c12d61c88a43e5f",
"check": "constable-states",
"impact": "Optimization",
@ -75,9 +75,9 @@
"start": 237,
"length": 20,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
10
@ -93,9 +93,9 @@
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
@ -124,9 +124,9 @@
}
}
],
"description": "A.test (tests/detectors/constable-states/const_state_variables.sol#10) should be constant\n",
"markdown": "[A.test](tests/detectors/constable-states/const_state_variables.sol#L10) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L10",
"description": "A.test (tests/detectors/constable-states/0.4.25/const_state_variables.sol#10) should be constant\n",
"markdown": "[A.test](tests/detectors/constable-states/0.4.25/const_state_variables.sol#L10) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.4.25/const_state_variables.sol#L10",
"id": "5d9e3fb413322b71a93e90f7e89bd8c83cd4884d577d039598c681fe9db38b1d",
"check": "constable-states",
"impact": "Optimization",
@ -141,9 +141,9 @@
"start": 333,
"length": 20,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
14
@ -159,9 +159,9 @@
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
@ -190,9 +190,9 @@
}
}
],
"description": "A.text2 (tests/detectors/constable-states/const_state_variables.sol#14) should be constant\n",
"markdown": "[A.text2](tests/detectors/constable-states/const_state_variables.sol#L14) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L14",
"description": "A.text2 (tests/detectors/constable-states/0.4.25/const_state_variables.sol#14) should be constant\n",
"markdown": "[A.text2](tests/detectors/constable-states/0.4.25/const_state_variables.sol#L14) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.4.25/const_state_variables.sol#L14",
"id": "df11e6201c4558a8c5cd90b55b134b9ca8f07203b2264d3aa93bd7745e8cb4ba",
"check": "constable-states",
"impact": "Optimization",
@ -207,9 +207,9 @@
"start": 496,
"length": 76,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
26
@ -225,9 +225,9 @@
"start": 473,
"length": 271,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
24,
@ -252,9 +252,9 @@
}
}
],
"description": "B.mySistersAddress (tests/detectors/constable-states/const_state_variables.sol#26) should be constant\n",
"markdown": "[B.mySistersAddress](tests/detectors/constable-states/const_state_variables.sol#L26) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L26",
"description": "B.mySistersAddress (tests/detectors/constable-states/0.4.25/const_state_variables.sol#26) should be constant\n",
"markdown": "[B.mySistersAddress](tests/detectors/constable-states/0.4.25/const_state_variables.sol#L26) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.4.25/const_state_variables.sol#L26",
"id": "bee93a722c8eae4a48aade67d8ef537d84c106f48fc9eb738c795fce10d3bc63",
"check": "constable-states",
"impact": "Optimization",
@ -269,9 +269,9 @@
"start": 793,
"length": 42,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
42
@ -287,9 +287,9 @@
"start": 746,
"length": 342,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
39,
@ -314,9 +314,9 @@
}
}
],
"description": "MyConc.should_be_constant (tests/detectors/constable-states/const_state_variables.sol#42) should be constant\n",
"markdown": "[MyConc.should_be_constant](tests/detectors/constable-states/const_state_variables.sol#L42) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L42",
"description": "MyConc.should_be_constant (tests/detectors/constable-states/0.4.25/const_state_variables.sol#42) should be constant\n",
"markdown": "[MyConc.should_be_constant](tests/detectors/constable-states/0.4.25/const_state_variables.sol#L42) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.4.25/const_state_variables.sol#L42",
"id": "cbcafa2a3efba4d21ac1b51b4b823e5082d556bc3d6cf3fd2ab3188f9f218fc1",
"check": "constable-states",
"impact": "Optimization",
@ -331,9 +331,9 @@
"start": 841,
"length": 33,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
43
@ -349,9 +349,9 @@
"start": 746,
"length": 342,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.4.25/const_state_variables.sol",
"is_dependency": false,
"lines": [
39,
@ -376,9 +376,9 @@
}
}
],
"description": "MyConc.should_be_constant_2 (tests/detectors/constable-states/const_state_variables.sol#43) should be constant\n",
"markdown": "[MyConc.should_be_constant_2](tests/detectors/constable-states/const_state_variables.sol#L43) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L43",
"description": "MyConc.should_be_constant_2 (tests/detectors/constable-states/0.4.25/const_state_variables.sol#43) should be constant\n",
"markdown": "[MyConc.should_be_constant_2](tests/detectors/constable-states/0.4.25/const_state_variables.sol#L43) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.4.25/const_state_variables.sol#L43",
"id": "9a48a4122de1a6a4774a9f1e0d4917bd0fa08f17b4af41b86ba07689e51bf711",
"check": "constable-states",
"impact": "Optimization",

@ -0,0 +1,52 @@
//pragma solidity ^0.4.24;
contract A {
address constant public MY_ADDRESS = 0xE0f5206BBD039e7b0592d8918820024e2a7437b9;
address public myFriendsAddress = 0xc0ffee254729296a45a3885639AC7E10F9d54979;
uint public used;
uint public test = 5;
uint constant X = 32**22 + 8;
string constant TEXT1 = "abc";
string text2 = "xyz";
function setUsed() public {
if (msg.sender == MY_ADDRESS) {
used = test;
}
}
}
contract B is A {
address public mySistersAddress = 0x999999cf1046e68e36E1aA2E0E07105eDDD1f08E;
function () external {
used = 0;
}
function setUsed(uint a) public {
if (msg.sender == MY_ADDRESS) {
used = a;
}
}
}
contract MyConc{
uint constant A = 1;
bytes32 should_be_constant = sha256('abc');
uint should_be_constant_2 = A + 1;
address not_constant = msg.sender;
uint not_constant_2 = getNumber();
uint not_constant_3 = 10 + block.number;
function getNumber() public returns(uint){
return block.number;
}
}

@ -0,0 +1,388 @@
[
[
{
"elements": [
{
"type": "variable",
"name": "myFriendsAddress",
"source_mapping": {
"start": 132,
"length": 76,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
7
],
"starting_column": 5,
"ending_column": 81
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "A.myFriendsAddress (tests/detectors/constable-states/0.5.16/const_state_variables.sol#7) should be constant\n",
"markdown": "[A.myFriendsAddress](tests/detectors/constable-states/0.5.16/const_state_variables.sol#L7) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.5.16/const_state_variables.sol#L7",
"id": "1454db80653b732bf6acbe54ff0ae4707002207a2a8216708c12d61c88a43e5f",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "test",
"source_mapping": {
"start": 237,
"length": 20,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
10
],
"starting_column": 5,
"ending_column": 25
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "A.test (tests/detectors/constable-states/0.5.16/const_state_variables.sol#10) should be constant\n",
"markdown": "[A.test](tests/detectors/constable-states/0.5.16/const_state_variables.sol#L10) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.5.16/const_state_variables.sol#L10",
"id": "5d9e3fb413322b71a93e90f7e89bd8c83cd4884d577d039598c681fe9db38b1d",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "text2",
"source_mapping": {
"start": 333,
"length": 20,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
14
],
"starting_column": 5,
"ending_column": 25
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "A.text2 (tests/detectors/constable-states/0.5.16/const_state_variables.sol#14) should be constant\n",
"markdown": "[A.text2](tests/detectors/constable-states/0.5.16/const_state_variables.sol#L14) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.5.16/const_state_variables.sol#L14",
"id": "df11e6201c4558a8c5cd90b55b134b9ca8f07203b2264d3aa93bd7745e8cb4ba",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "mySistersAddress",
"source_mapping": {
"start": 496,
"length": 76,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
26
],
"starting_column": 5,
"ending_column": 81
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "B",
"source_mapping": {
"start": 473,
"length": 271,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "B.mySistersAddress (tests/detectors/constable-states/0.5.16/const_state_variables.sol#26) should be constant\n",
"markdown": "[B.mySistersAddress](tests/detectors/constable-states/0.5.16/const_state_variables.sol#L26) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.5.16/const_state_variables.sol#L26",
"id": "bee93a722c8eae4a48aade67d8ef537d84c106f48fc9eb738c795fce10d3bc63",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "should_be_constant",
"source_mapping": {
"start": 793,
"length": 42,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
42
],
"starting_column": 5,
"ending_column": 47
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 746,
"length": 342,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "MyConc.should_be_constant (tests/detectors/constable-states/0.5.16/const_state_variables.sol#42) should be constant\n",
"markdown": "[MyConc.should_be_constant](tests/detectors/constable-states/0.5.16/const_state_variables.sol#L42) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.5.16/const_state_variables.sol#L42",
"id": "cbcafa2a3efba4d21ac1b51b4b823e5082d556bc3d6cf3fd2ab3188f9f218fc1",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "should_be_constant_2",
"source_mapping": {
"start": 841,
"length": 33,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
43
],
"starting_column": 5,
"ending_column": 38
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 746,
"length": 342,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.5.16/const_state_variables.sol",
"is_dependency": false,
"lines": [
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "MyConc.should_be_constant_2 (tests/detectors/constable-states/0.5.16/const_state_variables.sol#43) should be constant\n",
"markdown": "[MyConc.should_be_constant_2](tests/detectors/constable-states/0.5.16/const_state_variables.sol#L43) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.5.16/const_state_variables.sol#L43",
"id": "9a48a4122de1a6a4774a9f1e0d4917bd0fa08f17b4af41b86ba07689e51bf711",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
}
]
]

@ -0,0 +1,52 @@
//pragma solidity ^0.4.24;
contract A {
address constant public MY_ADDRESS = 0xE0f5206BBD039e7b0592d8918820024e2a7437b9;
address public myFriendsAddress = 0xc0ffee254729296a45a3885639AC7E10F9d54979;
uint public used;
uint public test = 5;
uint constant X = 32**22 + 8;
string constant TEXT1 = "abc";
string text2 = "xyz";
function setUsed() public {
if (msg.sender == MY_ADDRESS) {
used = test;
}
}
}
contract B is A {
address public mySistersAddress = 0x999999cf1046e68e36E1aA2E0E07105eDDD1f08E;
fallback () external {
used = 0;
}
function setUsed(uint a) public {
if (msg.sender == MY_ADDRESS) {
used = a;
}
}
}
contract MyConc{
uint constant A = 1;
bytes32 should_be_constant = sha256('abc');
uint should_be_constant_2 = A + 1;
address not_constant = msg.sender;
uint not_constant_2 = getNumber();
uint not_constant_3 = 10 + block.number;
function getNumber() public returns(uint){
return block.number;
}
}

@ -0,0 +1,388 @@
[
[
{
"elements": [
{
"type": "variable",
"name": "myFriendsAddress",
"source_mapping": {
"start": 132,
"length": 76,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
7
],
"starting_column": 5,
"ending_column": 81
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "A.myFriendsAddress (tests/detectors/constable-states/0.6.11/const_state_variables.sol#7) should be constant\n",
"markdown": "[A.myFriendsAddress](tests/detectors/constable-states/0.6.11/const_state_variables.sol#L7) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.6.11/const_state_variables.sol#L7",
"id": "1454db80653b732bf6acbe54ff0ae4707002207a2a8216708c12d61c88a43e5f",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "test",
"source_mapping": {
"start": 237,
"length": 20,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
10
],
"starting_column": 5,
"ending_column": 25
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "A.test (tests/detectors/constable-states/0.6.11/const_state_variables.sol#10) should be constant\n",
"markdown": "[A.test](tests/detectors/constable-states/0.6.11/const_state_variables.sol#L10) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.6.11/const_state_variables.sol#L10",
"id": "5d9e3fb413322b71a93e90f7e89bd8c83cd4884d577d039598c681fe9db38b1d",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "text2",
"source_mapping": {
"start": 333,
"length": 20,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
14
],
"starting_column": 5,
"ending_column": 25
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "A",
"source_mapping": {
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "A.text2 (tests/detectors/constable-states/0.6.11/const_state_variables.sol#14) should be constant\n",
"markdown": "[A.text2](tests/detectors/constable-states/0.6.11/const_state_variables.sol#L14) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.6.11/const_state_variables.sol#L14",
"id": "df11e6201c4558a8c5cd90b55b134b9ca8f07203b2264d3aa93bd7745e8cb4ba",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "mySistersAddress",
"source_mapping": {
"start": 496,
"length": 76,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
26
],
"starting_column": 5,
"ending_column": 81
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "B",
"source_mapping": {
"start": 473,
"length": 271,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "B.mySistersAddress (tests/detectors/constable-states/0.6.11/const_state_variables.sol#26) should be constant\n",
"markdown": "[B.mySistersAddress](tests/detectors/constable-states/0.6.11/const_state_variables.sol#L26) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.6.11/const_state_variables.sol#L26",
"id": "bee93a722c8eae4a48aade67d8ef537d84c106f48fc9eb738c795fce10d3bc63",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "should_be_constant",
"source_mapping": {
"start": 793,
"length": 42,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
42
],
"starting_column": 5,
"ending_column": 47
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 746,
"length": 342,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "MyConc.should_be_constant (tests/detectors/constable-states/0.6.11/const_state_variables.sol#42) should be constant\n",
"markdown": "[MyConc.should_be_constant](tests/detectors/constable-states/0.6.11/const_state_variables.sol#L42) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.6.11/const_state_variables.sol#L42",
"id": "cbcafa2a3efba4d21ac1b51b4b823e5082d556bc3d6cf3fd2ab3188f9f218fc1",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "should_be_constant_2",
"source_mapping": {
"start": 841,
"length": 33,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
43
],
"starting_column": 5,
"ending_column": 38
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "MyConc",
"source_mapping": {
"start": 746,
"length": 342,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/0.6.11/const_state_variables.sol",
"is_dependency": false,
"lines": [
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52
],
"starting_column": 1,
"ending_column": 2
}
}
}
}
],
"description": "MyConc.should_be_constant_2 (tests/detectors/constable-states/0.6.11/const_state_variables.sol#43) should be constant\n",
"markdown": "[MyConc.should_be_constant_2](tests/detectors/constable-states/0.6.11/const_state_variables.sol#L43) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.6.11/const_state_variables.sol#L43",
"id": "9a48a4122de1a6a4774a9f1e0d4917bd0fa08f17b4af41b86ba07689e51bf711",
"check": "constable-states",
"impact": "Optimization",
"confidence": "High"
}
]
]

@ -0,0 +1,52 @@
//pragma solidity ^0.4.24;
contract A {
address constant public MY_ADDRESS = 0xE0f5206BBD039e7b0592d8918820024e2a7437b9;
address public myFriendsAddress = 0xc0ffee254729296a45a3885639AC7E10F9d54979;
uint public used;
uint public test = 5;
uint constant X = 32**22 + 8;
string constant TEXT1 = "abc";
string text2 = "xyz";
function setUsed() public {
if (msg.sender == MY_ADDRESS) {
used = test;
}
}
}
contract B is A {
address public mySistersAddress = 0x999999cf1046e68e36E1aA2E0E07105eDDD1f08E;
fallback () external {
used = 0;
}
function setUsed(uint a) public {
if (msg.sender == MY_ADDRESS) {
used = a;
}
}
}
contract MyConc{
uint constant A = 1;
bytes32 should_be_constant = sha256('abc');
uint should_be_constant_2 = A + 1;
address not_constant = msg.sender;
uint not_constant_2 = getNumber();
uint not_constant_3 = 10 + block.number;
function getNumber() public returns(uint){
return block.number;
}
}

@ -9,9 +9,9 @@
"start": 132,
"length": 76,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
7
@ -27,9 +27,9 @@
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
@ -58,9 +58,9 @@
}
}
],
"description": "A.myFriendsAddress (tests/detectors/constable-states/const_state_variables.sol#7) should be constant\n",
"markdown": "[A.myFriendsAddress](tests/detectors/constable-states/const_state_variables.sol#L7) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L7",
"description": "A.myFriendsAddress (tests/detectors/constable-states/0.7.6/const_state_variables.sol#7) should be constant\n",
"markdown": "[A.myFriendsAddress](tests/detectors/constable-states/0.7.6/const_state_variables.sol#L7) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.7.6/const_state_variables.sol#L7",
"id": "1454db80653b732bf6acbe54ff0ae4707002207a2a8216708c12d61c88a43e5f",
"check": "constable-states",
"impact": "Optimization",
@ -75,9 +75,9 @@
"start": 237,
"length": 20,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
10
@ -93,9 +93,9 @@
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
@ -124,9 +124,9 @@
}
}
],
"description": "A.test (tests/detectors/constable-states/const_state_variables.sol#10) should be constant\n",
"markdown": "[A.test](tests/detectors/constable-states/const_state_variables.sol#L10) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L10",
"description": "A.test (tests/detectors/constable-states/0.7.6/const_state_variables.sol#10) should be constant\n",
"markdown": "[A.test](tests/detectors/constable-states/0.7.6/const_state_variables.sol#L10) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.7.6/const_state_variables.sol#L10",
"id": "5d9e3fb413322b71a93e90f7e89bd8c83cd4884d577d039598c681fe9db38b1d",
"check": "constable-states",
"impact": "Optimization",
@ -141,9 +141,9 @@
"start": 333,
"length": 20,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
14
@ -159,9 +159,9 @@
"start": 29,
"length": 441,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
4,
@ -190,9 +190,9 @@
}
}
],
"description": "A.text2 (tests/detectors/constable-states/const_state_variables.sol#14) should be constant\n",
"markdown": "[A.text2](tests/detectors/constable-states/const_state_variables.sol#L14) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L14",
"description": "A.text2 (tests/detectors/constable-states/0.7.6/const_state_variables.sol#14) should be constant\n",
"markdown": "[A.text2](tests/detectors/constable-states/0.7.6/const_state_variables.sol#L14) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.7.6/const_state_variables.sol#L14",
"id": "df11e6201c4558a8c5cd90b55b134b9ca8f07203b2264d3aa93bd7745e8cb4ba",
"check": "constable-states",
"impact": "Optimization",
@ -207,9 +207,9 @@
"start": 496,
"length": 76,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
26
@ -225,9 +225,9 @@
"start": 473,
"length": 271,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
24,
@ -252,9 +252,9 @@
}
}
],
"description": "B.mySistersAddress (tests/detectors/constable-states/const_state_variables.sol#26) should be constant\n",
"markdown": "[B.mySistersAddress](tests/detectors/constable-states/const_state_variables.sol#L26) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L26",
"description": "B.mySistersAddress (tests/detectors/constable-states/0.7.6/const_state_variables.sol#26) should be constant\n",
"markdown": "[B.mySistersAddress](tests/detectors/constable-states/0.7.6/const_state_variables.sol#L26) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.7.6/const_state_variables.sol#L26",
"id": "bee93a722c8eae4a48aade67d8ef537d84c106f48fc9eb738c795fce10d3bc63",
"check": "constable-states",
"impact": "Optimization",
@ -269,9 +269,9 @@
"start": 793,
"length": 42,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
42
@ -287,9 +287,9 @@
"start": 746,
"length": 342,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
39,
@ -314,9 +314,9 @@
}
}
],
"description": "MyConc.should_be_constant (tests/detectors/constable-states/const_state_variables.sol#42) should be constant\n",
"markdown": "[MyConc.should_be_constant](tests/detectors/constable-states/const_state_variables.sol#L42) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L42",
"description": "MyConc.should_be_constant (tests/detectors/constable-states/0.7.6/const_state_variables.sol#42) should be constant\n",
"markdown": "[MyConc.should_be_constant](tests/detectors/constable-states/0.7.6/const_state_variables.sol#L42) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.7.6/const_state_variables.sol#L42",
"id": "cbcafa2a3efba4d21ac1b51b4b823e5082d556bc3d6cf3fd2ab3188f9f218fc1",
"check": "constable-states",
"impact": "Optimization",
@ -331,9 +331,9 @@
"start": 841,
"length": 33,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
43
@ -349,9 +349,9 @@
"start": 746,
"length": 342,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constable-states/const_state_variables.sol",
"filename_relative": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constable-states/const_state_variables.sol",
"filename_short": "tests/detectors/constable-states/0.7.6/const_state_variables.sol",
"is_dependency": false,
"lines": [
39,
@ -376,9 +376,9 @@
}
}
],
"description": "MyConc.should_be_constant_2 (tests/detectors/constable-states/const_state_variables.sol#43) should be constant\n",
"markdown": "[MyConc.should_be_constant_2](tests/detectors/constable-states/const_state_variables.sol#L43) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/const_state_variables.sol#L43",
"description": "MyConc.should_be_constant_2 (tests/detectors/constable-states/0.7.6/const_state_variables.sol#43) should be constant\n",
"markdown": "[MyConc.should_be_constant_2](tests/detectors/constable-states/0.7.6/const_state_variables.sol#L43) should be constant\n",
"first_markdown_element": "tests/detectors/constable-states/0.7.6/const_state_variables.sol#L43",
"id": "9a48a4122de1a6a4774a9f1e0d4917bd0fa08f17b4af41b86ba07689e51bf711",
"check": "constable-states",
"impact": "Optimization",

@ -9,9 +9,9 @@
"start": 324,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant-function-asm/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant-function-asm/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
22,
@ -29,9 +29,9 @@
"start": 0,
"length": 392,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant-function-asm/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant-function-asm/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
1,
@ -68,9 +68,9 @@
}
}
],
"description": "Constant.test_assembly_bug() (tests/detectors/constant/constant.sol#22-24) is declared view but contains assembly code\n",
"markdown": "[Constant.test_assembly_bug()](tests/detectors/constant/constant.sol#L22-L24) is declared view but contains assembly code\n",
"first_markdown_element": "tests/detectors/constant/constant.sol#L22-L24",
"description": "Constant.test_assembly_bug() (tests/detectors/constant-function-asm/0.4.25/constant.sol#22-24) is declared view but contains assembly code\n",
"markdown": "[Constant.test_assembly_bug()](tests/detectors/constant-function-asm/0.4.25/constant.sol#L22-L24) is declared view but contains assembly code\n",
"first_markdown_element": "tests/detectors/constant-function-asm/0.4.25/constant.sol#L22-L24",
"id": "1f892cae08b89096bdc4d6ecdf55a3adc4b4314390e054fe2547d9c8e9f76e23",
"additional_fields": {
"contains_assembly": true

@ -1,4 +1,4 @@
pragma solidity 0.5.1;
// pragma solidity 0.5.1;
contract Constant {

@ -0,0 +1,20 @@
// pragma solidity 0.5.1;
contract Constant {
uint a;
function test_view_shadow() public view{
uint a;
a = 0;
}
function test_view() public view{
a;
}
function test_assembly_bug() public view{
assembly{}
}
}

@ -0,0 +1,20 @@
// pragma solidity 0.5.1;
contract Constant {
uint a;
function test_view_shadow() public view{
uint a;
a = 0;
}
function test_view() public view{
a;
}
function test_assembly_bug() public view{
assembly{}
}
}

@ -0,0 +1,25 @@
contract Constant {
uint a;
function test_view_bug() public view{
a = 0;
}
function test_constant_bug() public constant{
a = 0;
}
function test_view_shadow() public view{
uint a;
a = 0;
}
function test_view() public view{
a;
}
function test_assembly_bug() public view{
assembly{}
}
}

@ -9,9 +9,9 @@
"start": 45,
"length": 58,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
5,
@ -29,9 +29,9 @@
"start": 0,
"length": 392,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
1,
@ -74,9 +74,9 @@
"start": 28,
"length": 6,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
3
@ -92,9 +92,9 @@
"start": 0,
"length": 392,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
1,
@ -130,9 +130,9 @@
}
}
],
"description": "Constant.test_view_bug() (tests/detectors/constant/constant.sol#5-7) is declared view but changes state variables:\n\t- Constant.a (tests/detectors/constant/constant.sol#3)\n",
"markdown": "[Constant.test_view_bug()](tests/detectors/constant/constant.sol#L5-L7) is declared view but changes state variables:\n\t- [Constant.a](tests/detectors/constant/constant.sol#L3)\n",
"first_markdown_element": "tests/detectors/constant/constant.sol#L5-L7",
"description": "Constant.test_view_bug() (tests/detectors/constant-function-state/0.4.25/constant.sol#5-7) is declared view but changes state variables:\n\t- Constant.a (tests/detectors/constant-function-state/0.4.25/constant.sol#3)\n",
"markdown": "[Constant.test_view_bug()](tests/detectors/constant-function-state/0.4.25/constant.sol#L5-L7) is declared view but changes state variables:\n\t- [Constant.a](tests/detectors/constant-function-state/0.4.25/constant.sol#L3)\n",
"first_markdown_element": "tests/detectors/constant-function-state/0.4.25/constant.sol#L5-L7",
"id": "4dee61d8835d20c6f1f7c195d8bd1e9de5dbcc096396a5b8db391136f9f5fdf1",
"additional_fields": {
"contains_assembly": false
@ -150,9 +150,9 @@
"start": 113,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
9,
@ -170,9 +170,9 @@
"start": 0,
"length": 392,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
1,
@ -215,9 +215,9 @@
"start": 28,
"length": 6,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
3
@ -233,9 +233,9 @@
"start": 0,
"length": 392,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant-function-state/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
1,
@ -271,9 +271,9 @@
}
}
],
"description": "Constant.test_constant_bug() (tests/detectors/constant/constant.sol#9-11) is declared view but changes state variables:\n\t- Constant.a (tests/detectors/constant/constant.sol#3)\n",
"markdown": "[Constant.test_constant_bug()](tests/detectors/constant/constant.sol#L9-L11) is declared view but changes state variables:\n\t- [Constant.a](tests/detectors/constant/constant.sol#L3)\n",
"first_markdown_element": "tests/detectors/constant/constant.sol#L9-L11",
"description": "Constant.test_constant_bug() (tests/detectors/constant-function-state/0.4.25/constant.sol#9-11) is declared view but changes state variables:\n\t- Constant.a (tests/detectors/constant-function-state/0.4.25/constant.sol#3)\n",
"markdown": "[Constant.test_constant_bug()](tests/detectors/constant-function-state/0.4.25/constant.sol#L9-L11) is declared view but changes state variables:\n\t- [Constant.a](tests/detectors/constant-function-state/0.4.25/constant.sol#L3)\n",
"first_markdown_element": "tests/detectors/constant-function-state/0.4.25/constant.sol#L9-L11",
"id": "145e2d34dfc5b932c8d67d480c0eaec9baa8c728e2a310529572c0c4a5c6046a",
"additional_fields": {
"contains_assembly": false

@ -0,0 +1,20 @@
// pragma solidity 0.5.1;
contract Constant {
uint a;
function test_view_shadow() public view{
uint a;
a = 0;
}
function test_view() public view{
a;
}
function test_assembly_bug() public view{
assembly{}
}
}

@ -0,0 +1,20 @@
// pragma solidity 0.5.1;
contract Constant {
uint a;
function test_view_shadow() public view{
uint a;
a = 0;
}
function test_view() public view{
a;
}
function test_assembly_bug() public view{
assembly{}
}
}

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

Loading…
Cancel
Save