From ff9643d7b8132501f9e7d23aea05a4a09c98348f Mon Sep 17 00:00:00 2001 From: Bernhard Mueller Date: Tue, 27 Feb 2018 23:54:37 +0700 Subject: [PATCH] Fix logic bug in the way srcmap-runtime is parsed --- mythril/analysis/report.py | 6 ++++-- mythril/ether/soliditycontract.py | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mythril/analysis/report.py b/mythril/analysis/report.py index 34c81db6..48bf7dbc 100644 --- a/mythril/analysis/report.py +++ b/mythril/analysis/report.py @@ -99,8 +99,10 @@ class Report: text += "### Description\n" + issue.description + "\n" - if issue.filename and issue.code: - text += "\nIn *" + issue.filename + ":*\n" + if issue.filename and issue.lineno: + text += "\nIn *%s:*\n%d" % (issue.filename, issue.lineno) + + if issue.code: text += "\n```\n" + issue.code + "\n```\n" return text diff --git a/mythril/ether/soliditycontract.py b/mythril/ether/soliditycontract.py index 9737e081..3e6bcf8d 100644 --- a/mythril/ether/soliditycontract.py +++ b/mythril/ether/soliditycontract.py @@ -56,6 +56,7 @@ class SolidityContract(ETHContract): self.name = name self.code = contract['bin-runtime'] self.creation_code = contract['bin'] + srcmap = contract['srcmap-runtime'].split(";") has_contract = True if not has_contract: @@ -63,10 +64,7 @@ class SolidityContract(ETHContract): self.mappings = [] - srcmap = contract['srcmap-runtime'].split(";") - for item in srcmap: - mapping = item.split(":") if len(mapping) > 0 and len(mapping[0]) > 0: