Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-297

Maximum recursion depth for macro calls

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All
    • Bugzilla Id:
      31563

      Description

      Similar to the option "directive.parse.maxdepth" I would love to see a parameter
      to limit the depth of macro call recursion. In my scenario I let simple users
      write macros to create html pages. Using recursive macros, they could get the
      application to misbehave.

      The following piece of code illustrates the problem:

      #macro ( showInfo $p )
      Info: $p
      #showInfo($p)
      #end
      #showInfo("Test")

      Which simply leads to:

      java.lang.StackOverflowError
      at
      org.apache.velocity.runtime.parser.node.ASTStringLiteral.value(ASTStringLiteral.java:136)
      at
      org.apache.velocity.runtime.directive.VMProxyArg.getObject(VMProxyArg.java:294)
      at org.apache.velocity.context.VMContext.get(VMContext.java:181)
      ....

      Current workaround: Disable inline macros. Have responsible Script-Developers.

        Attachments

        1. MacroMaxCallDepth.patch
          17 kB
          Supun Kamburugamuva

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jochen@jtoee.com Jochen Toppe
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: