From d00152f8e4d925c7749d63b533152a937e1dd516 Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Sun, 9 Jan 2022 12:30:40 +0000 Subject: [PATCH] Handle cases with symbolic bytecode (#1581) * Fix issues with string code * revert solc changes --- myth | 2 +- mythril/laser/plugin/plugins/coverage/coverage_plugin.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/myth b/myth index 0f6189c7..1eeb58da 100755 --- a/myth +++ b/myth @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """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 import mythril.interfaces.cli diff --git a/mythril/laser/plugin/plugins/coverage/coverage_plugin.py b/mythril/laser/plugin/plugins/coverage/coverage_plugin.py index cf123e2d..f235a5e8 100644 --- a/mythril/laser/plugin/plugins/coverage/coverage_plugin.py +++ b/mythril/laser/plugin/plugins/coverage/coverage_plugin.py @@ -55,7 +55,10 @@ class InstructionCoveragePlugin(LaserPlugin): cov_percentage = sum(code_cov[1]) / float(code_cov[0]) * 100 string_code = code if type(code) == tuple: - string_code = bytearray(code).hex() + try: + string_code = bytearray(code).hex() + except TypeError: + string_code = "" log.info( "Achieved {:.2f}% coverage for code: {}".format( cov_percentage, string_code