From 39f8273df00839625ab1c718e76b76a811cec5e7 Mon Sep 17 00:00:00 2001 From: Joran Honig Date: Wed, 19 Feb 2020 14:01:40 +0100 Subject: [PATCH] cast target type in execute method of detection module --- mythril/analysis/module/base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mythril/analysis/module/base.py b/mythril/analysis/module/base.py index f60a871e..31bd9b66 100644 --- a/mythril/analysis/module/base.py +++ b/mythril/analysis/module/base.py @@ -4,7 +4,7 @@ This module includes an definition of the DetectionModule interface. DetectionModules implement different analysis rules to find weaknesses and vulnerabilities. """ import logging -from typing import List, Set, Optional, Union +from typing import List, Set, Optional, Union, cast from mythril.analysis.report import Issue from mythril.analysis.symbolic import SymExecWrapper @@ -69,6 +69,11 @@ class DetectionModule(ABC): log.debug("Entering analysis module: {}".format(self.__class__.__name__)) + if self.entry_point.CALLBACK: + cast(GlobalState, target) + else: + cast(SymExecWrapper, target) + result = self._execute(target) log.debug("Exiting analysis module: {}".format(self.__class__.__name__)) @@ -77,7 +82,7 @@ class DetectionModule(ABC): @abstractmethod def _execute( - self, target: Union[SymExecWrapper, GlobalState] + self, target ) -> Optional[List[Issue]]: """Module main method (override this)