Fix incorrect constructor called

pull/416/head
Josselin 5 years ago
parent ac368bba9c
commit 43335d52f5
  1. 8
      slither/slithir/convert.py
  2. 1
      slither/solc_parsing/cfg/node.py

@ -672,6 +672,14 @@ def extract_tmp_call(ins, contract):
# Called a base constructor, where there is no constructor
if ins.called.constructor is None:
return Nop()
# Case where:
# contract A{ constructor(uint) }
# contract B is A {}
# contract C is B{ constructor() A(10) B() {}
# C calls B(), which does not exist
# Ideally we should compare here for the parameters types too
if len(ins.called.constructor.parameters) != ins.nbr_arguments:
return Nop()
internalcall = InternalCall(ins.called.constructor, ins.nbr_arguments, ins.lvalue,
ins.type_call)
internalcall.call_id = ins.call_id

@ -66,4 +66,3 @@ class NodeSolc(Node):
self._external_calls_as_expressions = [c for c in self.calls_as_expression if not isinstance(c.called, Identifier)]
self._internal_calls_as_expressions = [c for c in self.calls_as_expression if isinstance(c.called, Identifier)]

Loading…
Cancel
Save