Document Tact's parser limits for deeply nested expressions
Closed this issue · 0 comments
anton-trunov commented
The Ohm parser generator uses recursion to parse nested items in expressions and throws a stack overflow exception for deeply nested expression like the following:
contract Foo {
get fun foo(): Int { return
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
1
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
}
}
Here is the exact error message:
💼 Compiling project test ...
Tact compilation failed
RangeError: Maximum call stack size exceeded
at Apply.evalOnce (/Users/anton-m1/ton/tact/node_modules/ohm-js/dist/ohm.cjs:2252:36)
at Apply.reallyEval (/Users/anton-m1/ton/tact/node_modules/ohm-js/dist/ohm.cjs:2192:20)
at Apply.eval (/Users/anton-m1/ton/tact/node_modules/ohm-js/dist/ohm.cjs:2147:14)
at MatchState.eval (/Users/anton-m1/ton/tact/node_modules/ohm-js/dist/ohm.cjs:3474:22)
at Alt.eval (/Users/anton-m1/ton/tact/node_modules/ohm-js/dist/ohm.cjs:2019:15)
at MatchState.eval (/Users/anton-m1/ton/tact/node_modules/ohm-js/dist/ohm.cjs:3474:22)
at Apply.evalOnce (/Users/anton-m1/ton/tact/node_modules/ohm-js/dist/ohm.cjs:2256:13)
at Apply.reallyEval (/Users/anton-m1/ton/tact/node_modules/ohm-js/dist/ohm.cjs:2192:20)
at Apply.eval (/Users/anton-m1/ton/tact/node_modules/ohm-js/dist/ohm.cjs:2147:14)
at MatchState.eval (/Users/anton-m1/ton/tact/node_modules/ohm-js/dist/ohm.cjs:3474:22)
This can be mitigated or solved in various ways, but for now we need to document the limitation to finish the security audit process.