diff --git a/mythril/ethereum/util.py b/mythril/ethereum/util.py index 76017951..f5d0383b 100644 --- a/mythril/ethereum/util.py +++ b/mythril/ethereum/util.py @@ -156,7 +156,7 @@ def parse_pragma(solidity_code): max_version = Optional(inequality + version) pragma = Word("pragma") + Word("solidity") + min_version + Optional(max_version) result = pragma.parseString(solidity_code) - min_inequality = result[2] if result[2] in [">", "<", ">=", "<="] else "" + min_inequality = result[2] if result[2] in [">", "<", ">=", "<=", "="] else "" min_carrot = result[2] if result[2] == "^" else "" min_version = result[3] if min_carrot != "" or min_inequality != "" else result[2] return { diff --git a/tests/util_tests.py b/tests/util_tests.py index 59366ca9..06fdea89 100644 --- a/tests/util_tests.py +++ b/tests/util_tests.py @@ -5,6 +5,7 @@ from mythril.ethereum.util import extract_version test_data = ( ("pragma solidity 0.5.0\n", ["0.5.0"]), + ("pragma solidity =0.5.0\n", ["0.5.0"]), ("pragma solidity ^0.4.26\n", ["0.4.26"]), ("pragma solidity ^0.6.3;\n", [f"0.6.{x}" for x in range(3, 13)]), ("pragma solidity ^0.6.3 ;\n", [f"0.6.{x}" for x in range(3, 13)]),