Handle constructor edge case (#1600)

* Init config dir

* Fix solc optimizer

* Handle constructor edge case
pull/1608/head
Nikhil Parasaram 3 years ago committed by GitHub
parent 85296a4eb4
commit cf0cb1520b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      mythril/analysis/report.py

@ -143,13 +143,21 @@ class Issue:
:param contract: :param contract:
""" """
if self.address and isinstance(contract, SolidityContract): if self.address and isinstance(contract, SolidityContract):
is_constructor = False
if (
contract.creation_code
in self.transaction_sequence["steps"][-1]["input"]
and self.function == "constructor"
):
is_constructor = True
if self.source_location: if self.source_location:
codeinfo = contract.get_source_info( codeinfo = contract.get_source_info(
self.source_location, constructor=(self.function == "constructor") self.source_location, constructor=is_constructor
) )
else: else:
codeinfo = contract.get_source_info( codeinfo = contract.get_source_info(
self.address, constructor=(self.function == "constructor") self.address, constructor=is_constructor
) )
if codeinfo is None: if codeinfo is None:

Loading…
Cancel
Save