Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.1
-
None
Description
WHAT:
Since JEXL allows recursion, it would be convenient to stop execution early when running towards a stack overflow. In general, scripts don't have much use for recursion so this would be a good (soft) safeguard.
Incidentally, when a function called by a script ends up in a stack overflow, it would be nice to catch it and properly propagate it through a JexlException.
HOW:
Introduce a new JexlException subclass (StackOverflow) that can be thrown after catching a (JVM) StackOverflow in Interpreter.interpret().
The StackOverflow soft limit -ie one that pertains to JEXL only - requires a new JexlBuilder option (stackOverflow(size)) and a way to count the stack 'height'; easiest/safest seems to put interpreter instance in TLS and increment/check a 'frame pointer' member.