Commit b9acaa55 authored by Iuri Matias's avatar Iuri Matias

address code review: guard against infinite recursion; fix array inside array

parent 1bcbfe6a
...@@ -108,7 +108,10 @@ class InternalCallTree { ...@@ -108,7 +108,10 @@ class InternalCallTree {
let scopeId = this.scopeStarts[scope.firstStep] let scopeId = this.scopeStarts[scope.firstStep]
let functions = [] let functions = []
if (!scopeId) return functions if (!scopeId) return functions
let i = 0
while (true) { while (true) {
i += 1
if (i > 1000) throw new Error('retrieFunctionStack: recursion too deep')
let functionDefinition = this.functionDefinitionsByScope[scopeId] let functionDefinition = this.functionDefinitionsByScope[scopeId]
if (functionDefinition !== undefined) { if (functionDefinition !== undefined) {
functions.push(functionDefinition) functions.push(functionDefinition)
...@@ -268,7 +271,7 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc ...@@ -268,7 +271,7 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc
} }
// input params // input params
if (inputs) { if (inputs) {
functionDefinitionAndInputs.inputs.push(addParams(inputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, inputs.children.length, -1)) functionDefinitionAndInputs.inputs = addParams(inputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, inputs.children.length, -1)
} }
// output params // output params
if (outputs) addParams(outputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, 0, 1) if (outputs) addParams(outputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, 0, 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment