Perform a nesting decoding (#1754)

* Perform a nesting decoding

* Remove unwanted statement
pull/1757/head
Nikhil Parasaram 2 years ago committed by GitHub
parent 4c16585a7f
commit c0e8b67952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      mythril/analysis/report.py
  2. 1
      mythril/interfaces/cli.py

@ -172,6 +172,15 @@ class Issue:
else:
self.source_mapping = self.address
@staticmethod
def decode_bytes(val):
if isinstance(val, bytes):
return val.decode()
elif isinstance(val, list) or isinstance(val, tuple):
return [Issue.decode_bytes(x) for x in val]
else:
return val
def resolve_function_names(self):
"""Resolves function names for each step"""
@ -197,11 +206,7 @@ class Issue:
if step["resolved_input"] is not None:
step["resolved_input"] = list(step["resolved_input"])
for i, val in enumerate(step["resolved_input"]):
if type(val) != bytes:
continue
# Some of the bytes violate UTF-8 and UTF-16 translates the input to Japanese
# We cannot directly use bytes, as it's not serialisable using JSON, hence this hack.
step["resolved_input"][i] = str(step["resolved_input"][i])
step["resolved_input"][i] = Issue.decode_bytes(val)
step["resolved_input"] = tuple(step["resolved_input"])

@ -865,6 +865,7 @@ def execute_command(
else None,
transaction_count=args.transaction_count,
)
outputs = {
"json": report.as_json(),
"jsonv2": report.as_swc_standard_format(),

Loading…
Cancel
Save