Fix incorrect tuple type in case of low level call (fix #529)

pull/539/head
Josselin 4 years ago
parent 9e69274e45
commit c9fdc0b0af
  1. 5
      slither/slithir/convert.py
  2. 7
      slither/slithir/operations/low_level_call.py
  3. 3
      slither/visitors/slithir/expression_to_slithir.py

@ -763,7 +763,10 @@ def convert_to_low_level(ir):
new_ir.call_gas = ir.call_gas
new_ir.call_value = ir.call_value
new_ir.arguments = ir.arguments
new_ir.lvalue.set_type(ElementaryType('bool'))
if ir.slither.solc_version >= "0.5":
new_ir.lvalue.set_type([ElementaryType('bool'), ElementaryType('bytes')])
else:
new_ir.lvalue.set_type(ElementaryType('bool'))
new_ir.set_expression(ir.expression)
new_ir.set_node(ir.node)
return new_ir

@ -95,9 +95,14 @@ class LowLevelCall(Call, OperationWithLValue):
arguments = []
if self.arguments:
arguments = self.arguments
return_type = self.lvalue.type
if return_type and isinstance(return_type, list):
return_type = ','.join(str(x) for x in return_type)
txt = '{}({}) = LOW_LEVEL_CALL, dest:{}, function:{}, arguments:{} {} {}'
return txt.format(self.lvalue,
self.lvalue.type,
return_type,
self.destination,
self.function_name,
[str(x) for x in arguments],

@ -115,14 +115,11 @@ class ExpressionToSlithIR(ExpressionVisitor):
set_val(expression, None)
else:
assert isinstance(right, TupleVariable)
tuple_types = []
for idx in range(len(left)):
if not left[idx] is None:
operation = Unpack(left[idx], right, idx)
operation.set_expression(expression)
tuple_types.append(left[idx].type)
self._result.append(operation)
right.set_type(tuple_types)
set_val(expression, None)
else:
# Init of array, like

Loading…
Cancel
Save