Use proper title for integer underflow

pull/862/head
Nikhil Parasaram 6 years ago
parent 57403c185d
commit d9350d2334
  1. 8
      mythril/analysis/modules/integer.py
  2. 21
      tests/testdata/outputs_expected/overflow.sol.o.json
  3. 12
      tests/testdata/outputs_expected/overflow.sol.o.markdown
  4. 11
      tests/testdata/outputs_expected/overflow.sol.o.text
  5. 21
      tests/testdata/outputs_expected/underflow.sol.o.json
  6. 12
      tests/testdata/outputs_expected/underflow.sol.o.markdown
  7. 11
      tests/testdata/outputs_expected/underflow.sol.o.text

@ -168,13 +168,19 @@ class IntegerOverflowUnderflowModule(DetectionModule):
continue continue
ostate = annotation.overflowing_state ostate = annotation.overflowing_state
node = ostate.node node = ostate.node
title = (
"Integer Underflow"
if annotation.operator == "subtraction"
else "Integer Overflow"
)
issue = Issue( issue = Issue(
contract=node.contract_name, contract=node.contract_name,
function_name=node.function_name, function_name=node.function_name,
address=ostate.get_current_instruction()["address"], address=ostate.get_current_instruction()["address"],
swc_id=INTEGER_OVERFLOW_AND_UNDERFLOW, swc_id=INTEGER_OVERFLOW_AND_UNDERFLOW,
bytecode=ostate.environment.code.bytecode, bytecode=ostate.environment.code.bytecode,
title="Integer Overflow", title=title,
_type="Warning", _type="Warning",
gas_used=(state.mstate.min_gas_used, state.mstate.max_gas_used), gas_used=(state.mstate.min_gas_used, state.mstate.max_gas_used),
) )

@ -1,19 +1,6 @@
{ {
"error": null, "error": null,
"issues":[ "issues": [{
{
"address":567,
"contract":"Unknown",
"debug":"<DEBUG-DATA>",
"description":"This binary subtraction operation can result in integer overflow.\n",
"function":"sendeth(address,uint256)",
"max_gas_used":1053,
"min_gas_used":768,
"swc-id":"101",
"title":"Integer Overflow",
"type":"Warning"
},
{
"address": 567, "address": 567,
"contract": "Unknown", "contract": "Unknown",
"debug": "<DEBUG-DATA>", "debug": "<DEBUG-DATA>",
@ -24,8 +11,7 @@
"swc-id": "101", "swc-id": "101",
"title": "Integer Underflow", "title": "Integer Underflow",
"type": "Warning" "type": "Warning"
}, }, {
{
"address": 649, "address": 649,
"contract": "Unknown", "contract": "Unknown",
"debug": "<DEBUG-DATA>", "debug": "<DEBUG-DATA>",
@ -36,7 +22,6 @@
"swc-id": "101", "swc-id": "101",
"title": "Integer Underflow", "title": "Integer Underflow",
"type": "Warning" "type": "Warning"
} }],
],
"success": true "success": true
} }

@ -1,17 +1,5 @@
# Analysis results for test-filename.sol # Analysis results for test-filename.sol
## Integer Overflow
- SWC ID: 101
- Type: Warning
- Contract: Unknown
- Function name: `sendeth(address,uint256)`
- PC address: 567
- Estimated Gas Usage: 768 - 1053
### Description
This binary subtraction operation can result in integer overflow.
## Integer Underflow ## Integer Underflow
- SWC ID: 101 - SWC ID: 101
- Type: Warning - Type: Warning

@ -1,14 +1,3 @@
==== Integer Overflow ====
SWC ID: 101
Type: Warning
Contract: Unknown
Function name: sendeth(address,uint256)
PC address: 567
Estimated Gas Usage: 768 - 1053
This binary subtraction operation can result in integer overflow.
--------------------
==== Integer Underflow ==== ==== Integer Underflow ====
SWC ID: 101 SWC ID: 101
Type: Warning Type: Warning

@ -1,19 +1,6 @@
{ {
"error": null, "error": null,
"issues":[ "issues": [{
{
"address":567,
"contract":"Unknown",
"debug":"<DEBUG-DATA>",
"description":"This binary subtraction operation can result in integer overflow.\n",
"function":"sendeth(address,uint256)",
"max_gas_used":1053,
"min_gas_used":768,
"swc-id":"101",
"title":"Integer Overflow",
"type":"Warning"
},
{
"address": 567, "address": 567,
"contract": "Unknown", "contract": "Unknown",
"debug": "<DEBUG-DATA>", "debug": "<DEBUG-DATA>",
@ -24,8 +11,7 @@
"swc-id": "101", "swc-id": "101",
"title": "Integer Underflow", "title": "Integer Underflow",
"type": "Warning" "type": "Warning"
}, }, {
{
"address": 649, "address": 649,
"contract": "Unknown", "contract": "Unknown",
"debug": "<DEBUG-DATA>", "debug": "<DEBUG-DATA>",
@ -36,7 +22,6 @@
"swc-id": "101", "swc-id": "101",
"title": "Integer Underflow", "title": "Integer Underflow",
"type": "Warning" "type": "Warning"
} }],
],
"success": true "success": true
} }

@ -1,17 +1,5 @@
# Analysis results for test-filename.sol # Analysis results for test-filename.sol
## Integer Overflow
- SWC ID: 101
- Type: Warning
- Contract: Unknown
- Function name: `sendeth(address,uint256)`
- PC address: 567
- Estimated Gas Usage: 768 - 1053
### Description
This binary subtraction operation can result in integer overflow.
## Integer Underflow ## Integer Underflow
- SWC ID: 101 - SWC ID: 101
- Type: Warning - Type: Warning

@ -1,14 +1,3 @@
==== Integer Overflow ====
SWC ID: 101
Type: Warning
Contract: Unknown
Function name: sendeth(address,uint256)
PC address: 567
Estimated Gas Usage: 768 - 1053
This binary subtraction operation can result in integer overflow.
--------------------
==== Integer Underflow ==== ==== Integer Underflow ====
SWC ID: 101 SWC ID: 101
Type: Warning Type: Warning

Loading…
Cancel
Save