From ee90356eee5aeab74dd9af049b23ca99cfe82dcf Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Fri, 30 Nov 2018 17:47:55 +0530 Subject: [PATCH] Fixes the calldata problem --- mythril/laser/ethereum/state/calldata.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mythril/laser/ethereum/state/calldata.py b/mythril/laser/ethereum/state/calldata.py index 3cbbf834..5e53bab5 100644 --- a/mythril/laser/ethereum/state/calldata.py +++ b/mythril/laser/ethereum/state/calldata.py @@ -108,18 +108,17 @@ class SymbolicCalldata(BaseCalldata): :param tx_id: Id of the transaction that the calldata is for. """ self._reads = [] - self._size = BitVec("calldatasize", 256) + self._size = BitVec(str(tx_id) + "_calldatasize", 256) super().__init__(tx_id) def _load(self, item: Union[int, ExprRef], clean=False) -> Any: x = BitVecVal(item, 256) if isinstance(item, int) else item symbolic_base_value = If( - x > self._size, + x >= self._size, BitVecVal(0, 8), BitVec("{}_calldata_{}".format(self.tx_id, str(item)), 8), ) - return_value = symbolic_base_value for r_index, r_value in self._reads: return_value = If(r_index == item, r_value, return_value)