https://bugs.documentfoundation.org/show_bug.cgi?id=172867

            Bug ID: 172867
           Summary: Implement LAMBDA recursion limits, and tail call
                    optimization
           Product: LibreOffice
           Version: 27.2.0.0 alpha0+ master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
As currently implemented, the LAMBDA operator does not track recursion. I think
it would be worth adding an option to allow recursion to be limited. It should
have a reasonable default (256?), but it should be possible to change the
number or disable it entirely.

If the recursion tracking is disabled (at least), recursion should use
tail-call optimization, so that recursion can be truly unlimited. Turning
recursion tracking off should cause a warning to be issued to the user,
indicating that this should only be done with formulas that have been
thoroughly tested, as infinite recursion will crash or freeze Calc.

Steps to Reproduce:
1. Write a LAMBDA formula that includes infinite recursion, such as:
=LET(f;LAMBDA(self;x;self(x));f(f;5))()

Actual Results:
Calc crashes.

Expected Results:
Calc reports an error in that cell, unless recursion tracking is turned off.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Ideally, I think each document should be able to have a different setting for
this, but that raises security issues if the setting is stored (only) in the
document. Could a per-document setting be stored in the user's profile?

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to