Finding ID generation: prevent collision on pragma

pull/388/head
Josselin 5 years ago
parent de0f437f0f
commit 2dc71bcf75
  1. 3
      slither/utils/output.py
  2. 2
      tests/expected_json/old_solc.sol.json.solc-version.json
  3. 2
      tests/expected_json/pragma.0.4.24.pragma.json
  4. 4
      tests/expected_json/solc_version_incorrect.solc-version.json
  5. 4
      tests/expected_json/solc_version_incorrect_05.ast.json.solc-version.json

@ -120,6 +120,9 @@ def _convert_to_id(d):
else: else:
return f'{str(d)} ({d.source_mapping_str})' return f'{str(d)} ({d.source_mapping_str})'
if isinstance(d, Pragma):
return f'{d} ({d.source_mapping_str})'
if hasattr(d, 'canonical_name'): if hasattr(d, 'canonical_name'):
return f'{d.canonical_name}' return f'{d.canonical_name}'

@ -31,7 +31,7 @@
], ],
"description": "Pragma version0.4.21 (None) allows old versions\n", "description": "Pragma version0.4.21 (None) allows old versions\n",
"markdown": "Pragma version[0.4.21](None) allows old versions\n", "markdown": "Pragma version[0.4.21](None) allows old versions\n",
"id": "328ceb03806c74c48201abc80cb5625f6c8f47711913161dc99748ee6a99b64f", "id": "42d3e653dc8967543a723ca7014488c207b3e5e2d5774021d0932326e2483cb5",
"check": "solc-version", "check": "solc-version",
"impact": "Informational", "impact": "Informational",
"confidence": "High" "confidence": "High"

@ -60,7 +60,7 @@
], ],
"description": "Different versions of Solidity is used in :\n\t- Version used: ['^0.4.23', '^0.4.24']\n\t- ^0.4.23 (tests/pragma.0.4.23.sol#1)\n\t- ^0.4.24 (tests/pragma.0.4.24.sol#1)\n", "description": "Different versions of Solidity is used in :\n\t- Version used: ['^0.4.23', '^0.4.24']\n\t- ^0.4.23 (tests/pragma.0.4.23.sol#1)\n\t- ^0.4.24 (tests/pragma.0.4.24.sol#1)\n",
"markdown": "Different versions of Solidity is used in :\n\t- Version used: ['^0.4.23', '^0.4.24']\n\t- [^0.4.23](tests/pragma.0.4.23.sol#L1)\n\t- [^0.4.24](tests/pragma.0.4.24.sol#L1)\n", "markdown": "Different versions of Solidity is used in :\n\t- Version used: ['^0.4.23', '^0.4.24']\n\t- [^0.4.23](tests/pragma.0.4.23.sol#L1)\n\t- [^0.4.24](tests/pragma.0.4.24.sol#L1)\n",
"id": "ab9edf8af725d611d1eaeb16713c0f2e9f51804dc985b1bc823bd87645713fb7", "id": "05e3d32f70e37f2745b5defe65910aaf477ed4eef1e8d3d6a22dcb14c0634cb4",
"check": "pragma", "check": "pragma",
"impact": "Informational", "impact": "Informational",
"confidence": "High" "confidence": "High"

@ -34,7 +34,7 @@
], ],
"description": "Pragma version^0.4.23 (tests/solc_version_incorrect.sol#2) allows old versions\n", "description": "Pragma version^0.4.23 (tests/solc_version_incorrect.sol#2) allows old versions\n",
"markdown": "Pragma version[^0.4.23](tests/solc_version_incorrect.sol#L2) allows old versions\n", "markdown": "Pragma version[^0.4.23](tests/solc_version_incorrect.sol#L2) allows old versions\n",
"id": "c88d5b50c78f468b95732feb91693016824f78333adab2fdcca3152eec2bfa73", "id": "10a41e5fb84308a2a6123319b07b40eb1922f1a430a42ddf29e669fe4a929f32",
"check": "solc-version", "check": "solc-version",
"impact": "Informational", "impact": "Informational",
"confidence": "High" "confidence": "High"
@ -73,7 +73,7 @@
], ],
"description": "Pragma version>=0.4.0<0.6.0 (tests/solc_version_incorrect.sol#3) allows old versions\n", "description": "Pragma version>=0.4.0<0.6.0 (tests/solc_version_incorrect.sol#3) allows old versions\n",
"markdown": "Pragma version[>=0.4.0<0.6.0](tests/solc_version_incorrect.sol#L3) allows old versions\n", "markdown": "Pragma version[>=0.4.0<0.6.0](tests/solc_version_incorrect.sol#L3) allows old versions\n",
"id": "dfd3e70c2367b0c8eca5afa86d1773b9c7aa1d0a155e3a0495188800c41fe390", "id": "59afb064cee0498173127c1e2d23bd60852c1bc4de3d3c673026b3d2faa04134",
"check": "solc-version", "check": "solc-version",
"impact": "Informational", "impact": "Informational",
"confidence": "High" "confidence": "High"

@ -32,7 +32,7 @@
], ],
"description": "Pragma version^0.5.5 (None) is known to contain severe issue (https://solidity.readthedocs.io/en/v0.5.8/bugs.html)\n", "description": "Pragma version^0.5.5 (None) is known to contain severe issue (https://solidity.readthedocs.io/en/v0.5.8/bugs.html)\n",
"markdown": "Pragma version[^0.5.5](None) is known to contain severe issue (https://solidity.readthedocs.io/en/v0.5.8/bugs.html)\n", "markdown": "Pragma version[^0.5.5](None) is known to contain severe issue (https://solidity.readthedocs.io/en/v0.5.8/bugs.html)\n",
"id": "8bcf06a2e2c13723dbc16f843f73830ebdb86b7e8ee599524a0b9824bb89381c", "id": "fa84bcbd40d52d8846dcd54be4cada287e43c5461898c9acbf089ca8a478f6e5",
"check": "solc-version", "check": "solc-version",
"impact": "Informational", "impact": "Informational",
"confidence": "High" "confidence": "High"
@ -65,7 +65,7 @@
], ],
"description": "Pragma version0.5.7 (None) necessitates versions too recent to be trusted. Consider deploying with 0.5.3\n", "description": "Pragma version0.5.7 (None) necessitates versions too recent to be trusted. Consider deploying with 0.5.3\n",
"markdown": "Pragma version[0.5.7](None) necessitates versions too recent to be trusted. Consider deploying with 0.5.3\n", "markdown": "Pragma version[0.5.7](None) necessitates versions too recent to be trusted. Consider deploying with 0.5.3\n",
"id": "997cf0cfc722f31f7566c3fd180c01b0c7466a19df7c65ee590e9f3778cf62ee", "id": "5889f3ae12e005170e40681552a9752c2900f44ce9ab0e6d721dc78f89ae05fa",
"check": "solc-version", "check": "solc-version",
"impact": "Informational", "impact": "Informational",
"confidence": "High" "confidence": "High"

Loading…
Cancel
Save