ruuda / rcl

A reasonable configuration language
https://rcl-lang.org
Apache License 2.0
197 stars 8 forks source link

Add evaluation limit #33

Closed ruuda closed 8 months ago

ruuda commented 8 months ago

The fuzzer has discovered some interesting programs that diverge, in particular this one:

let f = g => g(g(h => k => g(g(h))));
f(f)

It still puzzles me: it loops infinitely without causing a stack overflow. To make sure the fuzzer doesn’t get stuck on cases like these, add a limit on the number of evaluation steps. Perhaps in the future it should be configurable for people who want to evaluate huge documents for legitimate reasons, but for now a hard-coded limit works fine.

(This is extracted from #26, I added it there first, but I keep running into this and that big pull request will take some time to get merged. So it’s good to extract pieces that can be merged already.)