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. 65
      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. 65
      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
ostate = annotation.overflowing_state
node = ostate.node
title = (
"Integer Underflow"
if annotation.operator == "subtraction"
else "Integer Overflow"
)
issue = Issue(
contract=node.contract_name,
function_name=node.function_name,
address=ostate.get_current_instruction()["address"],
swc_id=INTEGER_OVERFLOW_AND_UNDERFLOW,
bytecode=ostate.environment.code.bytecode,
title="Integer Overflow",
title=title,
_type="Warning",
gas_used=(state.mstate.min_gas_used, state.mstate.max_gas_used),
)

@ -1,42 +1,27 @@
{
"error":null,
"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,
"contract":"Unknown",
"debug":"<DEBUG-DATA>",
"description":"This binary subtraction operation can result in integer underflow.\n",
"function":"sendeth(address,uint256)",
"max_gas_used":1774,
"min_gas_used":1299,
"swc-id":"101",
"title":"Integer Underflow",
"type":"Warning"
},
{
"address":649,
"contract":"Unknown",
"debug":"<DEBUG-DATA>",
"description":"This binary subtraction operation can result in integer underflow.\n",
"function":"sendeth(address,uint256)",
"max_gas_used":1774,
"min_gas_used":1299,
"swc-id":"101",
"title":"Integer Underflow",
"type":"Warning"
}
],
"success":true
"error": null,
"issues": [{
"address": 567,
"contract": "Unknown",
"debug": "<DEBUG-DATA>",
"description": "This binary subtraction operation can result in integer underflow.\n",
"function": "sendeth(address,uint256)",
"max_gas_used": 1774,
"min_gas_used": 1299,
"swc-id": "101",
"title": "Integer Underflow",
"type": "Warning"
}, {
"address": 649,
"contract": "Unknown",
"debug": "<DEBUG-DATA>",
"description": "This binary subtraction operation can result in integer underflow.\n",
"function": "sendeth(address,uint256)",
"max_gas_used": 1774,
"min_gas_used": 1299,
"swc-id": "101",
"title": "Integer Underflow",
"type": "Warning"
}],
"success": true
}

@ -1,17 +1,5 @@
# 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
- SWC ID: 101
- 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 ====
SWC ID: 101
Type: Warning

@ -1,42 +1,27 @@
{
"error":null,
"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,
"contract":"Unknown",
"debug":"<DEBUG-DATA>",
"description":"This binary subtraction operation can result in integer underflow.\n",
"function":"sendeth(address,uint256)",
"max_gas_used":1774,
"min_gas_used":1299,
"swc-id":"101",
"title":"Integer Underflow",
"type":"Warning"
},
{
"address":649,
"contract":"Unknown",
"debug":"<DEBUG-DATA>",
"description":"This binary subtraction operation can result in integer underflow.\n",
"function":"sendeth(address,uint256)",
"max_gas_used":1774,
"min_gas_used":1299,
"swc-id":"101",
"title":"Integer Underflow",
"type":"Warning"
}
],
"success":true
"error": null,
"issues": [{
"address": 567,
"contract": "Unknown",
"debug": "<DEBUG-DATA>",
"description": "This binary subtraction operation can result in integer underflow.\n",
"function": "sendeth(address,uint256)",
"max_gas_used": 1774,
"min_gas_used": 1299,
"swc-id": "101",
"title": "Integer Underflow",
"type": "Warning"
}, {
"address": 649,
"contract": "Unknown",
"debug": "<DEBUG-DATA>",
"description": "This binary subtraction operation can result in integer underflow.\n",
"function": "sendeth(address,uint256)",
"max_gas_used": 1774,
"min_gas_used": 1299,
"swc-id": "101",
"title": "Integer Underflow",
"type": "Warning"
}],
"success": true
}

@ -1,17 +1,5 @@
# 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
- SWC ID: 101
- 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 ====
SWC ID: 101
Type: Warning

Loading…
Cancel
Save