falco icon indicating copy to clipboard operation
falco copied to clipboard

[BUG] VCL function recursion causes panic

Open richardmarshall opened this issue 11 months ago • 0 comments

Kind of proposals

  • [x] Simulator
  • [x] Testing

Describe the problem

Currently if a recursion loop is created the interpreter will not detect this and end up panicking with a stack overflow error.

VCL code that cause the problem / reproduceable

sub f1 {
        call f2;
}

sub f2 {
        call f1;
}
sub test {
        testing.call_subroutine("f1");
}
% falco test main.vcl 
Running tests...runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc03f1ea348 stack=[0xc03f1ea000, 0xc05f1ea000]
fatal error: stack overflow
...

Expected behavior

The interpreter should return an error and not panic.

richardmarshall avatar Apr 03 '24 01:04 richardmarshall