Fix logic bug in the way srcmap-runtime is parsed

pull/72/head
Bernhard Mueller 7 years ago
parent 73838195e7
commit ff9643d7b8
  1. 6
      mythril/analysis/report.py
  2. 4
      mythril/ether/soliditycontract.py

@ -99,8 +99,10 @@ class Report:
text += "### Description\n" + issue.description + "\n" text += "### Description\n" + issue.description + "\n"
if issue.filename and issue.code: if issue.filename and issue.lineno:
text += "\nIn *" + issue.filename + ":*\n" text += "\nIn *%s:*\n%d" % (issue.filename, issue.lineno)
if issue.code:
text += "\n```\n" + issue.code + "\n```\n" text += "\n```\n" + issue.code + "\n```\n"
return text return text

@ -56,6 +56,7 @@ class SolidityContract(ETHContract):
self.name = name self.name = name
self.code = contract['bin-runtime'] self.code = contract['bin-runtime']
self.creation_code = contract['bin'] self.creation_code = contract['bin']
srcmap = contract['srcmap-runtime'].split(";")
has_contract = True has_contract = True
if not has_contract: if not has_contract:
@ -63,10 +64,7 @@ class SolidityContract(ETHContract):
self.mappings = [] self.mappings = []
srcmap = contract['srcmap-runtime'].split(";")
for item in srcmap: for item in srcmap:
mapping = item.split(":") mapping = item.split(":")
if len(mapping) > 0 and len(mapping[0]) > 0: if len(mapping) > 0 and len(mapping[0]) > 0:

Loading…
Cancel
Save