restructure tests/

pull/825/head
Alexander Remie 4 years ago
parent cf07c59516
commit fa22b62634
  1. 0
      tests/detectors/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol
  2. 346
      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. 1828
      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. 388
      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. 388
      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. 0
      tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol.0.4.25.ArbitrarySend.json
  13. 388
      tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol.0.6.11.ArbitrarySend.json
  14. 41
      tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol
  15. 52
      tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol.0.7.6.ArbitrarySend.json
  16. 0
      tests/detectors/array-by-reference/0.4.25/array_by_reference.sol
  17. 176
      tests/detectors/array-by-reference/0.4.25/array_by_reference.sol.0.4.25.ArrayByReference.json
  18. 51
      tests/detectors/array-by-reference/0.5.16/array_by_reference.sol
  19. 1333
      tests/detectors/array-by-reference/0.5.16/array_by_reference.sol.0.5.16.ArrayByReference.json
  20. 51
      tests/detectors/array-by-reference/0.6.11/array_by_reference.sol
  21. 1333
      tests/detectors/array-by-reference/0.6.11/array_by_reference.sol.0.6.11.ArrayByReference.json
  22. 51
      tests/detectors/array-by-reference/0.7.6/array_by_reference.sol
  23. 1333
      tests/detectors/array-by-reference/0.7.6/array_by_reference.sol.0.7.6.ArrayByReference.json
  24. 0
      tests/detectors/assembly/0.4.25/inline_assembly_contract.sol
  25. 26
      tests/detectors/assembly/0.4.25/inline_assembly_contract.sol.0.4.25.Assembly.json
  26. 0
      tests/detectors/assembly/0.4.25/inline_assembly_library.sol
  27. 52
      tests/detectors/assembly/0.4.25/inline_assembly_library.sol.0.4.25.Assembly.json
  28. 0
      tests/detectors/assembly/0.5.16/inline_assembly_contract.sol
  29. 33
      tests/detectors/assembly/0.5.16/inline_assembly_contract.sol.0.5.16.Assembly.json
  30. 0
      tests/detectors/assembly/0.5.16/inline_assembly_library.sol
  31. 66
      tests/detectors/assembly/0.5.16/inline_assembly_library.sol.0.5.16.Assembly.json
  32. 20
      tests/detectors/assembly/0.6.11/inline_assembly_contract.sol
  33. 184
      tests/detectors/assembly/0.6.11/inline_assembly_contract.sol.0.6.11.Assembly.json
  34. 47
      tests/detectors/assembly/0.6.11/inline_assembly_library.sol
  35. 470
      tests/detectors/assembly/0.6.11/inline_assembly_library.sol.0.6.11.Assembly.json
  36. 20
      tests/detectors/assembly/0.7.6/inline_assembly_contract.sol
  37. 184
      tests/detectors/assembly/0.7.6/inline_assembly_contract.sol.0.7.6.Assembly.json
  38. 47
      tests/detectors/assembly/0.7.6/inline_assembly_library.sol
  39. 470
      tests/detectors/assembly/0.7.6/inline_assembly_library.sol.0.7.6.Assembly.json
  40. 0
      tests/detectors/assert-state-change/0.4.25/assert_state_change.sol
  41. 568
      tests/detectors/assert-state-change/0.4.25/assert_state_change.sol.0.4.25.AssertStateChange.json
  42. 39
      tests/detectors/assert-state-change/0.5.16/assert_state_change.sol
  43. 568
      tests/detectors/assert-state-change/0.5.16/assert_state_change.sol.0.5.16.AssertStateChange.json
  44. 39
      tests/detectors/assert-state-change/0.6.11/assert_state_change.sol
  45. 568
      tests/detectors/assert-state-change/0.6.11/assert_state_change.sol.0.6.11.AssertStateChange.json
  46. 39
      tests/detectors/assert-state-change/0.7.6/assert_state_change.sol
  47. 78
      tests/detectors/assert-state-change/0.7.6/assert_state_change.sol.0.7.6.AssertStateChange.json
  48. 0
      tests/detectors/backdoor/0.4.25/backdoor.sol
  49. 12
      tests/detectors/backdoor/0.4.25/backdoor.sol.0.4.25.Backdoor.json
  50. 8
      tests/detectors/backdoor/0.5.16/backdoor.sol
  51. 61
      tests/detectors/backdoor/0.5.16/backdoor.sol.0.5.16.Backdoor.json
  52. 8
      tests/detectors/backdoor/0.6.11/backdoor.sol
  53. 61
      tests/detectors/backdoor/0.6.11/backdoor.sol.0.6.11.Backdoor.json
  54. 8
      tests/detectors/backdoor/0.7.6/backdoor.sol
  55. 12
      tests/detectors/backdoor/0.7.6/backdoor.sol.0.7.6.Backdoor.json
  56. 0
      tests/detectors/boolean-constant-equality/0.4.25/boolean-constant-equality.sol
  57. 26
      tests/detectors/boolean-constant-equality/0.4.25/boolean-constant-equality.sol.0.4.25.BooleanEquality.json
  58. 27
      tests/detectors/boolean-constant-equality/0.5.16/boolean-constant-equality.sol
  59. 170
      tests/detectors/boolean-constant-equality/0.5.16/boolean-constant-equality.sol.0.5.16.BooleanEquality.json
  60. 27
      tests/detectors/boolean-constant-equality/0.6.11/boolean-constant-equality.sol
  61. 170
      tests/detectors/boolean-constant-equality/0.6.11/boolean-constant-equality.sol.0.6.11.BooleanEquality.json
  62. 27
      tests/detectors/boolean-constant-equality/0.7.6/boolean-constant-equality.sol
  63. 56
      tests/detectors/boolean-constant-equality/0.7.6/boolean-constant-equality.sol.0.7.6.BooleanEquality.json
  64. 0
      tests/detectors/boolean-constant-misuse/0.4.25/boolean-constant-misuse.sol
  65. 208
      tests/detectors/boolean-constant-misuse/0.4.25/boolean-constant-misuse.sol.0.4.25.BooleanConstantMisuse.json
  66. 46
      tests/detectors/boolean-constant-misuse/0.5.16/boolean-constant-misuse.sol
  67. 208
      tests/detectors/boolean-constant-misuse/0.5.16/boolean-constant-misuse.sol.0.5.16.BooleanConstantMisuse.json
  68. 46
      tests/detectors/boolean-constant-misuse/0.6.11/boolean-constant-misuse.sol
  69. 208
      tests/detectors/boolean-constant-misuse/0.6.11/boolean-constant-misuse.sol.0.6.11.BooleanConstantMisuse.json
  70. 46
      tests/detectors/boolean-constant-misuse/0.7.6/boolean-constant-misuse.sol
  71. 26
      tests/detectors/boolean-constant-misuse/0.7.6/boolean-constant-misuse.sol.0.7.6.BooleanConstantMisuse.json
  72. 0
      tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol
  73. 26
      tests/detectors/calls-loop/0.4.25/multiple_calls_in_loop.sol.0.4.25.MultipleCallsInLoop.json
  74. 15
      tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol
  75. 148
      tests/detectors/calls-loop/0.5.16/multiple_calls_in_loop.sol.0.5.16.MultipleCallsInLoop.json
  76. 15
      tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol
  77. 148
      tests/detectors/calls-loop/0.6.11/multiple_calls_in_loop.sol.0.6.11.MultipleCallsInLoop.json
  78. 15
      tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol
  79. 148
      tests/detectors/calls-loop/0.7.6/multiple_calls_in_loop.sol.0.7.6.MultipleCallsInLoop.json
  80. 0
      tests/detectors/constable-states/0.4.25/const_state_variables.sol
  81. 72
      tests/detectors/constable-states/0.4.25/const_state_variables.sol.0.4.25.ConstCandidateStateVars.json
  82. 52
      tests/detectors/constable-states/0.5.16/const_state_variables.sol
  83. 382
      tests/detectors/constable-states/0.5.16/const_state_variables.sol.0.5.16.ConstCandidateStateVars.json
  84. 52
      tests/detectors/constable-states/0.6.11/const_state_variables.sol
  85. 382
      tests/detectors/constable-states/0.6.11/const_state_variables.sol.0.6.11.ConstCandidateStateVars.json
  86. 52
      tests/detectors/constable-states/0.7.6/const_state_variables.sol
  87. 72
      tests/detectors/constable-states/0.7.6/const_state_variables.sol.0.7.6.ConstCandidateStateVars.json
  88. 0
      tests/detectors/constant/0.4.25/constant.sol
  89. 12
      tests/detectors/constant/0.4.25/constant.sol.0.4.25.ConstantFunctionsAsm.json
  90. 40
      tests/detectors/constant/0.4.25/constant.sol.0.4.25.ConstantFunctionsState.json
  91. 2
      tests/detectors/constant/0.5.16/constant.sol
  92. 0
      tests/detectors/constant/0.5.16/constant.sol.0.5.16.ConstantFunctionsAsm.json
  93. 0
      tests/detectors/constant/0.5.16/constant.sol.0.5.16.ConstantFunctionsState.json
  94. 20
      tests/detectors/constant/0.6.11/constant.sol
  95. 0
      tests/detectors/constant/0.6.11/constant.sol.0.6.11.ConstantFunctionsAsm.json
  96. 0
      tests/detectors/constant/0.6.11/constant.sol.0.6.11.ConstantFunctionsState.json
  97. 20
      tests/detectors/constant/0.7.6/constant.sol
  98. 0
      tests/detectors/constant/0.7.6/constant.sol.0.7.6.ConstantFunctionsAsm.json
  99. 0
      tests/detectors/constant/0.7.6/constant.sol.0.7.6.ConstantFunctionsState.json
  100. 0
      tests/detectors/controlled-array-length/0.4.25/array_length_assignment.sol
  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": "bad3",
"name": "bad4",
"source_mapping": {
"start": 1076,
"length": 154,
"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": [
39,
40,
41
44,
45,
46
],
"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": "bad3()"
"signature": "bad4()"
}
},
{
"type": "node",
"name": "b = abi.encode(s)",
"name": "event1_bad(bad_arr)",
"source_mapping": {
"start": 1195,
"length": 30,
"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": [
40
45
],
"starting_column": 5,
"ending_column": 35
"ending_column": 29
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad3",
"name": "bad4",
"source_mapping": {
"start": 1076,
"length": 154,
"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": [
39,
40,
41
44,
45,
46
],
"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,15 +291,15 @@
"ending_column": 2
}
},
"signature": "bad3()"
"signature": "bad4()"
}
}
}
}
],
"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",
"id": "2052add742fb8dc3fa2c9ce9f9adcf8515d049c55f39f32a405ef0f6c29b9c7f",
"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",
"id": "144c77aebb4037fe38c2864892ecb888a4fb7d5e92e321e664b2d2226658a166",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"
@ -308,19 +308,19 @@
"elements": [
{
"type": "function",
"name": "bad0",
"name": "bad3",
"source_mapping": {
"start": 540,
"length": 61,
"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": [
21,
22,
23
39,
40,
41
],
"starting_column": 3,
"ending_column": 4
@ -333,9 +333,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,
@ -440,42 +440,42 @@
"ending_column": 2
}
},
"signature": "bad0()"
"signature": "bad3()"
}
},
{
"type": "node",
"name": "this.bad0_external(bad_arr)",
"name": "b = abi.encode(s)",
"source_mapping": {
"start": 569,
"length": 27,
"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": [
22
40
],
"starting_column": 5,
"ending_column": 32
"ending_column": 35
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad0",
"name": "bad3",
"source_mapping": {
"start": 540,
"length": 61,
"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": [
21,
22,
23
39,
40,
41
],
"starting_column": 3,
"ending_column": 4
@ -488,9 +488,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,
@ -595,15 +595,15 @@
"ending_column": 2
}
},
"signature": "bad0()"
"signature": "bad3()"
}
}
}
}
],
"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",
"id": "42e7d1c56e5298ef4ddfcc69b4e6119d356b34740cde285337501b656b0d2e04",
"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",
"id": "0c50cf7f7b16d965ef04035beb09d25f3fa1fa4afeeb079ea42f2db879e8f1e9",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"
@ -617,9 +617,9 @@
"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": [
34,
@ -637,9 +637,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,
@ -754,9 +754,9 @@
"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": [
35
@ -772,9 +772,9 @@
"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": [
34,
@ -792,9 +792,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,
@ -905,9 +905,9 @@
}
}
],
"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",
"id": "767bd12bc81a7530972b0f2b069fb167efe0f2d6b6ec6d1b95aa39d1dd836a5d",
"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",
"id": "d5860309d331920d1e3f44508fea706df75a4a7c2e93666ca96ca00ef32d7e01",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"
@ -916,19 +916,19 @@
"elements": [
{
"type": "function",
"name": "bad4",
"name": "bad0",
"source_mapping": {
"start": 1296,
"length": 148,
"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": [
44,
45,
46
21,
22,
23
],
"starting_column": 3,
"ending_column": 4
@ -941,9 +941,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,
@ -1048,42 +1048,42 @@
"ending_column": 2
}
},
"signature": "bad4()"
"signature": "bad0()"
}
},
{
"type": "node",
"name": "event1_bad(bad_arr)",
"name": "this.bad0_external(bad_arr)",
"source_mapping": {
"start": 1415,
"length": 24,
"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": [
45
22
],
"starting_column": 5,
"ending_column": 29
"ending_column": 32
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad4",
"name": "bad0",
"source_mapping": {
"start": 1296,
"length": 148,
"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": [
44,
45,
46
21,
22,
23
],
"starting_column": 3,
"ending_column": 4
@ -1096,9 +1096,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,
@ -1203,15 +1203,15 @@
"ending_column": 2
}
},
"signature": "bad4()"
"signature": "bad0()"
}
}
}
}
],
"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",
"id": "a0f90ebd7deb3917f2b20550e5edc7749a3459d075ada68b6422521732674f8c",
"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",
"id": "3752da45df0ba78cc9ac01a10b398e4ad74e6ddd572764cf2f361e523a43a998",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"
@ -1220,19 +1220,19 @@
"elements": [
{
"type": "function",
"name": "bad1",
"name": "bad5",
"source_mapping": {
"start": 726,
"length": 63,
"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": [
29,
30,
31
49,
50,
51
],
"starting_column": 3,
"ending_column": 4
@ -1245,9 +1245,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,
@ -1352,42 +1352,42 @@
"ending_column": 2
}
},
"signature": "bad1(A.S[3])"
"signature": "bad5()"
}
},
{
"type": "node",
"name": "this.bad1_external(s)",
"name": "event2_bad(s)",
"source_mapping": {
"start": 763,
"length": 21,
"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": [
30
50
],
"starting_column": 5,
"ending_column": 26
"ending_column": 23
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"name": "bad5",
"source_mapping": {
"start": 726,
"length": 63,
"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": [
29,
30,
31
49,
50,
51
],
"starting_column": 3,
"ending_column": 4
@ -1400,9 +1400,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,
@ -1507,15 +1507,15 @@
"ending_column": 2
}
},
"signature": "bad1(A.S[3])"
"signature": "bad5()"
}
}
}
}
],
"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",
"id": "b57e7fe9f889943ab7d2d9879a1b13f52d3ed64db56ae2f14cbea6e8dafcd70b",
"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",
"id": "e77767c95f4548636027a859ca0c63402cfb50af242f116dd3cfc5b038a4128e",
"check": "abiencoderv2-array",
"impact": "High",
"confidence": "High"
@ -1524,19 +1524,19 @@
"elements": [
{
"type": "function",
"name": "bad5",
"name": "bad1",
"source_mapping": {
"start": 1511,
"length": 142,
"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": [
49,
50,
51
29,
30,
31
],
"starting_column": 3,
"ending_column": 4
@ -1549,9 +1549,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,
@ -1656,42 +1656,42 @@
"ending_column": 2
}
},
"signature": "bad5()"
"signature": "bad1(A.S[3])"
}
},
{
"type": "node",
"name": "event2_bad(s)",
"name": "this.bad1_external(s)",
"source_mapping": {
"start": 1630,
"length": 18,
"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": [
50
30
],
"starting_column": 5,
"ending_column": 23
"ending_column": 26
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad5",
"name": "bad1",
"source_mapping": {
"start": 1511,
"length": 142,
"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": [
49,
50,
51
29,
30,
31
],
"starting_column": 3,
"ending_column": 4
@ -1704,9 +1704,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,
@ -1811,15 +1811,15 @@
"ending_column": 2
}
},
"signature": "bad5()"
"signature": "bad1(A.S[3])"
}
}
}
}
],
"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",
"id": "1bb85eee97769e9220dcde2102945a4a66fb96f01f789049334828e9f002aef5",
"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",
"id": "3febdd98f71332c80290c9557c5ef89ea9dbea4f520a084b0307f21b00da5010",
"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);
}
}

@ -0,0 +1,388 @@
[
[
{
"elements": [
{
"type": "function",
"name": "direct",
"source_mapping": {
"start": 147,
"length": 79,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/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": 869,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/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": 181,
"length": 38,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/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": 147,
"length": 79,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/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": 869,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/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.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",
"id": "477cc1ab9fa3d2263400e47d09146eaed3e478f5eecf7856b59d49a2a5093a1c",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"
},
{
"elements": [
{
"type": "function",
"name": "indirect",
"source_mapping": {
"start": 301,
"length": 82,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/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": 869,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/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": 337,
"length": 39,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/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": 301,
"length": 82,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/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": 869,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/arbitrary-send/0.4.25/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.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",
"id": "4759805615df746a3d8a6c068ce885d2c18c46edf411f83ae004593958caafe7",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"
}
]
]

@ -0,0 +1,388 @@
[
[
{
"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",
"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",
"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,388 @@
[
[
{
"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",
"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",
"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,9 +185,9 @@
}
}
],
"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",
"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",
"id": "90d9178119fb586af18c2298136d7f1af4d33a9b702b94d2ca0fcdbe6ee783c6",
"check": "arbitrary-send",
"impact": "High",
"confidence": "Medium"
@ -201,9 +201,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,
@ -221,9 +221,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,
@ -282,9 +282,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
@ -300,9 +300,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,
@ -320,9 +320,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,
@ -377,9 +377,9 @@
}
}
],
"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",
"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",
"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,8 +209,8 @@
}
}
],
"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",
"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",
"id": "79a462bf06ae529ad099f2170100298da30766fcc06884e03436d2b53110d208",
"check": "array-by-reference",
"impact": "High",
@ -225,9 +225,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,
@ -247,9 +247,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,
@ -296,9 +296,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
@ -314,9 +314,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,
@ -362,9 +362,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,
@ -383,9 +383,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,
@ -426,8 +426,8 @@
}
}
],
"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",
"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",
"id": "7f1eda9be40002affd2e8e31d172d3ee3374f37b1106118c79f4add7a133bbd0",
"check": "array-by-reference",
"impact": "High",
@ -442,9 +442,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,
@ -465,9 +465,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,
@ -514,9 +514,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
@ -532,9 +532,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,
@ -555,9 +555,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,
@ -606,9 +606,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,
@ -626,9 +626,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,
@ -669,8 +669,8 @@
}
}
],
"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",
"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",
"id": "d039169712808e785bf2e53f322c1c6fcd6b93a0a0c17f1a701addd09ed83996",
"check": "array-by-reference",
"impact": "High",
@ -685,9 +685,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,
@ -708,9 +708,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,
@ -757,9 +757,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
@ -775,9 +775,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,
@ -798,9 +798,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,
@ -849,9 +849,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,
@ -870,9 +870,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,
@ -913,8 +913,8 @@
}
}
],
"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",
"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",
"id": "8655e8acd84a6e8152acd2d9730ea0dfdda0723e09b2dcbfdbbeb8da8bd04fa5",
"check": "array-by-reference",
"impact": "High",
@ -929,9 +929,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,
@ -953,9 +953,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,
@ -995,9 +995,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
@ -1013,9 +1013,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,
@ -1054,9 +1054,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,
@ -1074,9 +1074,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,
@ -1117,8 +1117,8 @@
}
}
],
"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",
"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",
"id": "1520955a53c36e391abbaf648a91a5a12d432f0f4746b0a8187d0988a6a66846",
"check": "array-by-reference",
"impact": "High",
@ -1133,9 +1133,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,
@ -1157,9 +1157,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,
@ -1199,9 +1199,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
@ -1217,9 +1217,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,
@ -1258,9 +1258,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,
@ -1279,9 +1279,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,
@ -1322,8 +1322,8 @@
}
}
],
"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",
"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",
"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,9 +174,9 @@
}
}
],
"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",
"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",
"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,9 +202,9 @@
}
}
],
"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",
"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",
"id": "7009ef6498fa29901fbf3e9e1971a19f6fa48c87be3b2592c632e05a4321e1d3",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
@ -218,9 +218,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,
@ -258,9 +258,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,
@ -322,9 +322,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,
@ -361,9 +361,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,
@ -401,9 +401,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,
@ -461,9 +461,9 @@
}
}
],
"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",
"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",
"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,9 +173,9 @@
}
}
],
"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",
"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",
"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,9 +201,9 @@
}
}
],
"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",
"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",
"id": "abf9dce26719358da77702aa40f23104cc83044d0b1cffb492e318360fb72b6f",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
@ -218,9 +217,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,
@ -258,9 +257,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,
@ -320,11 +319,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,
@ -347,11 +346,10 @@
43,
44,
45,
46,
47
46
],
"starting_column": 9,
"ending_column": 6
"ending_column": 10
},
"type_specific_fields": {
"parent": {
@ -361,9 +359,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,
@ -401,9 +399,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,
@ -461,9 +459,9 @@
}
}
],
"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",
"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",
"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,184 @@
[
[
{
"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",
"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,470 @@
[
[
{
"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",
"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",
"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,184 @@
[
[
{
"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",
"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,470 @@
[
[
{
"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",
"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",
"id": "5cafb3e9d7d87c17203cf2c296eeec7de6b774b2a8d71908f8cfc9b8d916cb4b",
"check": "assembly",
"impact": "Informational",
"confidence": "High"
}
]
]

@ -0,0 +1,568 @@
[
[
{
"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",
"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",
"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",
"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,568 @@
[
[
{
"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",
"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",
"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",
"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,568 @@
[
[
{
"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",
"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",
"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",
"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,9 +181,9 @@
}
}
],
"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",
"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",
"id": "a710d11e5510f0eb3acb2c1ec524779253f25bf2931bce4cb9c5c048ec586b80",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
@ -197,9 +197,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,
@ -217,9 +217,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,
@ -276,9 +276,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
@ -294,9 +294,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,
@ -314,9 +314,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,
@ -369,9 +369,9 @@
}
}
],
"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",
"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",
"id": "60ad080e2f9647b400851918171383a9aac2900cc0828121e441db4240911fba",
"check": "assert-state-change",
"impact": "Informational",
"confidence": "High"
@ -385,9 +385,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,
@ -405,9 +405,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,
@ -464,9 +464,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
@ -482,9 +482,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,
@ -502,9 +502,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,
@ -557,9 +557,9 @@
}
}
],
"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",
"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",
"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,8 +50,8 @@
}
}
],
"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",
"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",
"id": "8a9008f2f5cd23b34feb0235dcc30ecb8d09a10eff151b522939caead117ef7a",
"check": "backdoor",
"impact": "High",

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

@ -0,0 +1,61 @@
[
[
{
"elements": [
{
"type": "function",
"name": "i_am_a_backdoor",
"source_mapping": {
"start": 18,
"length": 74,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/0.5.16/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/0.5.16/backdoor.sol",
"is_dependency": false,
"lines": [
4,
5,
6
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "C",
"source_mapping": {
"start": 1,
"length": 94,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/0.5.16/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/0.5.16/backdoor.sol",
"is_dependency": false,
"lines": [
2,
3,
4,
5,
6,
7,
8
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "i_am_a_backdoor()"
}
}
],
"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",
"id": "8a9008f2f5cd23b34feb0235dcc30ecb8d09a10eff151b522939caead117ef7a",
"check": "backdoor",
"impact": "High",
"confidence": "High"
}
]
]

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

@ -0,0 +1,61 @@
[
[
{
"elements": [
{
"type": "function",
"name": "i_am_a_backdoor",
"source_mapping": {
"start": 18,
"length": 74,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/0.6.11/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/0.6.11/backdoor.sol",
"is_dependency": false,
"lines": [
4,
5,
6
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "C",
"source_mapping": {
"start": 1,
"length": 94,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/backdoor/0.6.11/backdoor.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/backdoor/0.6.11/backdoor.sol",
"is_dependency": false,
"lines": [
2,
3,
4,
5,
6,
7,
8
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "i_am_a_backdoor()"
}
}
],
"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",
"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,8 +50,8 @@
}
}
],
"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",
"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",
"id": "8a9008f2f5cd23b34feb0235dcc30ecb8d09a10eff151b522939caead117ef7a",
"check": "backdoor",
"impact": "High",

@ -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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/0.4.25/boolean-constant-equality.sol",
"is_dependency": false,
"lines": [
1,
@ -159,9 +159,9 @@
}
}
],
"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",
"id": "4a53e773c88b730f07c2e4106545df03b44679c56ee0d9dbd75dca010320e69c",
"description": "MyConc.bad1(bool) (tests/detectors/boolean-constant-equality/0.4.25/boolean-constant-equality.sol#7-9) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-constant-equality/0.4.25/boolean-constant-equality.sol#8)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-equality/0.4.25/boolean-constant-equality.sol#L7-L9) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-constant-equality/0.4.25/boolean-constant-equality.sol#L8)\n",
"id": "953771b4660b92d842bccca2554dbcb5bc0988f4b0875b573a0b1211959c84be",
"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,170 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 139,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-equality/0.5.16/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/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-constant-equality/0.5.16/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/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-constant-equality/0.5.16/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/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-constant-equality/0.5.16/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/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-constant-equality/0.5.16/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/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-constant-equality/0.5.16/boolean-constant-equality.sol#7-9) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-constant-equality/0.5.16/boolean-constant-equality.sol#8)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-equality/0.5.16/boolean-constant-equality.sol#L7-L9) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-constant-equality/0.5.16/boolean-constant-equality.sol#L8)\n",
"id": "55f3ed7ce9767b07a34113bd35c34e61c20eb8ec35174086cdfea6c0063bd946",
"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,170 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 139,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-equality/0.6.11/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/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-constant-equality/0.6.11/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/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-constant-equality/0.6.11/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/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-constant-equality/0.6.11/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/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-constant-equality/0.6.11/boolean-constant-equality.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-equality/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-constant-equality/0.6.11/boolean-constant-equality.sol#7-9) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-constant-equality/0.6.11/boolean-constant-equality.sol#8)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-equality/0.6.11/boolean-constant-equality.sol#L7-L9) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-constant-equality/0.6.11/boolean-constant-equality.sol#L8)\n",
"id": "c51b5452fc3e68aff071a2c4ab0963cbbb1b55871b53c0131c11d4cf8abd046f",
"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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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-constant-equality/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,9 @@
}
}
],
"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-constant-equality/0.7.6/boolean-constant-equality.sol#7-9) compares to a boolean constant:\n\t-(b == true) (tests/detectors/boolean-constant-equality/0.7.6/boolean-constant-equality.sol#8)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-equality/0.7.6/boolean-constant-equality.sol#L7-L9) compares to a boolean constant:\n\t-[(b == true)](tests/detectors/boolean-constant-equality/0.7.6/boolean-constant-equality.sol#L8)\n",
"id": "f74a4de05a37e9f8a5f8926e2981a611972623fd7a0281f6d2bc4ec32899abfe",
"check": "boolean-equal",
"impact": "Informational",
"confidence": "High"

@ -0,0 +1,208 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-misuse/0.4.25/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/0.4.25/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-constant-misuse/0.4.25/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/0.4.25/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-constant-misuse/0.4.25/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/0.4.25/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-constant-misuse/0.4.25/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/0.4.25/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-constant-misuse/0.4.25/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/0.4.25/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-constant-misuse/0.4.25/boolean-constant-misuse.sol#9-11) uses a Boolean constant improperly:\n\t-(b || true) (tests/detectors/boolean-constant-misuse/0.4.25/boolean-constant-misuse.sol#10)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-misuse/0.4.25/boolean-constant-misuse.sol#L9-L11) uses a Boolean constant improperly:\n\t-[(b || true)](tests/detectors/boolean-constant-misuse/0.4.25/boolean-constant-misuse.sol#L10)\n",
"id": "c8c323396d19d9ddfd97f18ed731c7f07bb1cc030c198c830b595a770aeb26c2",
"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,208 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-misuse/0.5.16/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/0.5.16/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-constant-misuse/0.5.16/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/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,
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-constant-misuse/0.5.16/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/0.5.16/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-constant-misuse/0.5.16/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/0.5.16/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-constant-misuse/0.5.16/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/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,
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-constant-misuse/0.5.16/boolean-constant-misuse.sol#9-11) uses a Boolean constant improperly:\n\t-(b || true) (tests/detectors/boolean-constant-misuse/0.5.16/boolean-constant-misuse.sol#10)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-misuse/0.5.16/boolean-constant-misuse.sol#L9-L11) uses a Boolean constant improperly:\n\t-[(b || true)](tests/detectors/boolean-constant-misuse/0.5.16/boolean-constant-misuse.sol#L10)\n",
"id": "f6ceb7e0651a96a88da265b955956fb4a3878f1491c81cf6bc8e433b5006e6aa",
"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,208 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 162,
"length": 84,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/boolean-constant-misuse/0.6.11/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/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-constant-misuse/0.6.11/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/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-constant-misuse/0.6.11/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/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-constant-misuse/0.6.11/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/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-constant-misuse/0.6.11/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/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-constant-misuse/0.6.11/boolean-constant-misuse.sol#9-11) uses a Boolean constant improperly:\n\t-(b || true) (tests/detectors/boolean-constant-misuse/0.6.11/boolean-constant-misuse.sol#10)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-misuse/0.6.11/boolean-constant-misuse.sol#L9-L11) uses a Boolean constant improperly:\n\t-[(b || true)](tests/detectors/boolean-constant-misuse/0.6.11/boolean-constant-misuse.sol#L10)\n",
"id": "0b2599e627a1163a49a4113426fe385f5987d7e247cdbe8e2d9b39988b95478a",
"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;
}
}

@ -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-constant-misuse/0.7.6/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_short": "tests/detectors/boolean-constant-misuse/0.7.6/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-constant-misuse/0.7.6/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_short": "tests/detectors/boolean-constant-misuse/0.7.6/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-constant-misuse/0.7.6/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_short": "tests/detectors/boolean-constant-misuse/0.7.6/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-constant-misuse/0.7.6/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_short": "tests/detectors/boolean-constant-misuse/0.7.6/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-constant-misuse/0.7.6/boolean-constant-misuse.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/boolean-constant-misuse/boolean-constant-misuse.sol",
"filename_short": "tests/detectors/boolean-constant-misuse/0.7.6/boolean-constant-misuse.sol",
"is_dependency": false,
"lines": [
1,
@ -197,9 +197,9 @@
}
}
],
"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",
"id": "12517fed0ec8f0a2232b467a6add9fd94a6a84325017e02e8a48794fc9112c6b",
"description": "MyConc.bad1(bool) (tests/detectors/boolean-constant-misuse/0.7.6/boolean-constant-misuse.sol#9-11) uses a Boolean constant improperly:\n\t-(b || true) (tests/detectors/boolean-constant-misuse/0.7.6/boolean-constant-misuse.sol#10)\n",
"markdown": "[MyConc.bad1(bool)](tests/detectors/boolean-constant-misuse/0.7.6/boolean-constant-misuse.sol#L9-L11) uses a Boolean constant improperly:\n\t-[(b || true)](tests/detectors/boolean-constant-misuse/0.7.6/boolean-constant-misuse.sol#L10)\n",
"id": "a7e009ec0e6c5e4bf5dd828bcbeff63d020b9e2a10ad7ad350c13ad8cd277697",
"check": "boolean-cst",
"impact": "Medium",
"confidence": "Medium"

@ -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,9 +137,9 @@
}
}
],
"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",
"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",
"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,148 @@
[
[
{
"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",
"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,148 @@
[
[
{
"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",
"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,148 @@
[
[
{
"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",
"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,8 +58,8 @@
}
}
],
"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",
"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",
"id": "1454db80653b732bf6acbe54ff0ae4707002207a2a8216708c12d61c88a43e5f",
"check": "constable-states",
"impact": "Optimization",
@ -74,9 +74,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
@ -92,9 +92,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,
@ -123,8 +123,8 @@
}
}
],
"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",
"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",
"id": "5d9e3fb413322b71a93e90f7e89bd8c83cd4884d577d039598c681fe9db38b1d",
"check": "constable-states",
"impact": "Optimization",
@ -139,9 +139,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
@ -157,9 +157,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,
@ -188,8 +188,8 @@
}
}
],
"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",
"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",
"id": "df11e6201c4558a8c5cd90b55b134b9ca8f07203b2264d3aa93bd7745e8cb4ba",
"check": "constable-states",
"impact": "Optimization",
@ -204,9 +204,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
@ -222,9 +222,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,
@ -249,8 +249,8 @@
}
}
],
"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",
"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",
"id": "bee93a722c8eae4a48aade67d8ef537d84c106f48fc9eb738c795fce10d3bc63",
"check": "constable-states",
"impact": "Optimization",
@ -265,9 +265,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
@ -283,9 +283,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,
@ -310,8 +310,8 @@
}
}
],
"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",
"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",
"id": "cbcafa2a3efba4d21ac1b51b4b823e5082d556bc3d6cf3fd2ab3188f9f218fc1",
"check": "constable-states",
"impact": "Optimization",
@ -326,9 +326,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
@ -344,9 +344,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,
@ -371,8 +371,8 @@
}
}
],
"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",
"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",
"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,382 @@
[
[
{
"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",
"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",
"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",
"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",
"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",
"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",
"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,382 @@
[
[
{
"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",
"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",
"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",
"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",
"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",
"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",
"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,8 +58,8 @@
}
}
],
"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",
"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",
"id": "1454db80653b732bf6acbe54ff0ae4707002207a2a8216708c12d61c88a43e5f",
"check": "constable-states",
"impact": "Optimization",
@ -74,9 +74,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
@ -92,9 +92,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,
@ -123,8 +123,8 @@
}
}
],
"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",
"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",
"id": "5d9e3fb413322b71a93e90f7e89bd8c83cd4884d577d039598c681fe9db38b1d",
"check": "constable-states",
"impact": "Optimization",
@ -139,9 +139,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
@ -157,9 +157,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,
@ -188,8 +188,8 @@
}
}
],
"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",
"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",
"id": "df11e6201c4558a8c5cd90b55b134b9ca8f07203b2264d3aa93bd7745e8cb4ba",
"check": "constable-states",
"impact": "Optimization",
@ -204,9 +204,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
@ -222,9 +222,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,
@ -249,8 +249,8 @@
}
}
],
"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",
"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",
"id": "bee93a722c8eae4a48aade67d8ef537d84c106f48fc9eb738c795fce10d3bc63",
"check": "constable-states",
"impact": "Optimization",
@ -265,9 +265,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
@ -283,9 +283,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,
@ -310,8 +310,8 @@
}
}
],
"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",
"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",
"id": "cbcafa2a3efba4d21ac1b51b4b823e5082d556bc3d6cf3fd2ab3188f9f218fc1",
"check": "constable-states",
"impact": "Optimization",
@ -326,9 +326,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
@ -344,9 +344,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,
@ -371,8 +371,8 @@
}
}
],
"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",
"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",
"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/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant/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/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
1,
@ -68,8 +68,8 @@
}
}
],
"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",
"description": "Constant.test_assembly_bug() (tests/detectors/constant/0.4.25/constant.sol#22-24) is declared view but contains assembly code\n",
"markdown": "[Constant.test_assembly_bug()](tests/detectors/constant/0.4.25/constant.sol#L22-L24) is declared view but contains assembly code\n",
"id": "1f892cae08b89096bdc4d6ecdf55a3adc4b4314390e054fe2547d9c8e9f76e23",
"additional_fields": {
"contains_assembly": true

@ -9,9 +9,9 @@
"start": 45,
"length": 58,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant/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/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant/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/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant/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/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
1,
@ -130,8 +130,8 @@
}
}
],
"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",
"description": "Constant.test_view_bug() (tests/detectors/constant/0.4.25/constant.sol#5-7) is declared view but changes state variables:\n\t- Constant.a (tests/detectors/constant/0.4.25/constant.sol#3)\n",
"markdown": "[Constant.test_view_bug()](tests/detectors/constant/0.4.25/constant.sol#L5-L7) is declared view but changes state variables:\n\t- [Constant.a](tests/detectors/constant/0.4.25/constant.sol#L3)\n",
"id": "4dee61d8835d20c6f1f7c195d8bd1e9de5dbcc096396a5b8db391136f9f5fdf1",
"additional_fields": {
"contains_assembly": false
@ -149,9 +149,9 @@
"start": 113,
"length": 66,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
9,
@ -169,9 +169,9 @@
"start": 0,
"length": 392,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
1,
@ -214,9 +214,9 @@
"start": 28,
"length": 6,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
3
@ -232,9 +232,9 @@
"start": 0,
"length": 392,
"filename_used": "/GENERIC_PATH",
"filename_relative": "tests/detectors/constant/constant.sol",
"filename_relative": "tests/detectors/constant/0.4.25/constant.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/constant/constant.sol",
"filename_short": "tests/detectors/constant/0.4.25/constant.sol",
"is_dependency": false,
"lines": [
1,
@ -270,8 +270,8 @@
}
}
],
"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",
"description": "Constant.test_constant_bug() (tests/detectors/constant/0.4.25/constant.sol#9-11) is declared view but changes state variables:\n\t- Constant.a (tests/detectors/constant/0.4.25/constant.sol#3)\n",
"markdown": "[Constant.test_constant_bug()](tests/detectors/constant/0.4.25/constant.sol#L9-L11) is declared view but changes state variables:\n\t- [Constant.a](tests/detectors/constant/0.4.25/constant.sol#L3)\n",
"id": "145e2d34dfc5b932c8d67d480c0eaec9baa8c728e2a310529572c0c4a5c6046a",
"additional_fields": {
"contains_assembly": false

@ -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{}
}
}

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

Loading…
Cancel
Save