Handle cases with symbolic bytecode (#1581)

* Fix issues with string code

* revert solc changes
pull/1582/head
Nikhil Parasaram 3 years ago committed by GitHub
parent 700950c9e1
commit d00152f8e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      myth
  2. 5
      mythril/laser/plugin/plugins/coverage/coverage_plugin.py

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""mythril.py: Bug hunting on the Ethereum blockchain """mythril.py: Bug hunting on the Ethereum blockchain
http://www.github.com/b-mueller/mythril http://www.github.com/ConsenSys/mythril
""" """
from sys import exit from sys import exit
import mythril.interfaces.cli import mythril.interfaces.cli

@ -55,7 +55,10 @@ class InstructionCoveragePlugin(LaserPlugin):
cov_percentage = sum(code_cov[1]) / float(code_cov[0]) * 100 cov_percentage = sum(code_cov[1]) / float(code_cov[0]) * 100
string_code = code string_code = code
if type(code) == tuple: if type(code) == tuple:
string_code = bytearray(code).hex() try:
string_code = bytearray(code).hex()
except TypeError:
string_code = "<symbolic code>"
log.info( log.info(
"Achieved {:.2f}% coverage for code: {}".format( "Achieved {:.2f}% coverage for code: {}".format(
cov_percentage, string_code cov_percentage, string_code

Loading…
Cancel
Save