From d791d105ec3887522fcc59000ca3fa896cb290c3 Mon Sep 17 00:00:00 2001 From: Josselin Date: Mon, 3 Aug 2020 11:01:45 +0200 Subject: [PATCH] Add temporary support for abi.decode on complex type (temporary solution until #566 is fixed) --- slither/slithir/convert.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slither/slithir/convert.py b/slither/slithir/convert.py index 57248fc2a..e625a10b2 100644 --- a/slither/slithir/convert.py +++ b/slither/slithir/convert.py @@ -812,7 +812,10 @@ def convert_to_solidity_func(ir): # abi.decode where the type to decode is a singleton # abi.decode(a, (uint)) elif call == SolidityFunction("abi.decode()") and len(new_ir.arguments) == 2: - new_ir.lvalue.set_type(new_ir.arguments[1]) + # If the variable is a referenceVariable, we are lost + # See https://github.com/crytic/slither/issues/566 for potential solutions + if not isinstance(new_ir.arguments[1], ReferenceVariable): + new_ir.lvalue.set_type(new_ir.arguments[1]) else: new_ir.lvalue.set_type(call.return_type) return new_ir