mvel/mvel — pull request #53 by efge (2014-02-06 12:44:37+00:00)
Title: MVEL-301: avoid exponential behavior when parsing nested substatements

Some expressions with nested substatements are parsed in a time exponential with respect to the number of substatements. Examples:
(A && (B && (C && (D && (E && F)))))
(A ? B : (C ? D : (E ? F : (G ? H : (I ? J : K)))))
(Add more levels to get actual failures, for instance here at around 18 levels it starts to get into tens of seconds time.)
The culprit seems to be repeated recursive calls to org.mvel2.compiler.ExpressionCompiler._compile.
I've tried fixing this using a caching layer (patch attached), but I'd like to know if this is correct as implemented.