From 6e779f827f1cf78411722c61efc563702079c07c Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Sat, 8 May 2021 21:41:13 +0200 Subject: [PATCH] cap default recursion limit at 1024 --- include/cubescript/cubescript/state.hh | 4 ++-- src/cs_thread.hh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/cubescript/cubescript/state.hh b/include/cubescript/cubescript/state.hh index e8868b2..0045207 100644 --- a/include/cubescript/cubescript/state.hh +++ b/include/cubescript/cubescript/state.hh @@ -420,13 +420,13 @@ struct LIBCUBESCRIPT_EXPORT state { /** @brief Get the maximum call depth of the VM * * If zero, it is unlimited, otherwise it specifies how much the VM is - * allowed to recurse. By default, it is zero. + * allowed to recurse. By default, it is 1024. */ std::size_t max_call_depth() const; /** @brief Set the maximum call depth ov the VM * - * If zero, it is unlimited (this is the default). You can limit how much + * If zero, it is unlimited (the default is 1024). You can limit how much * the VM is allowed to recurse if you have specific constraints to adhere * to. * diff --git a/src/cs_thread.hh b/src/cs_thread.hh index 6899cdc..4858dfc 100644 --- a/src/cs_thread.hh +++ b/src/cs_thread.hh @@ -36,7 +36,7 @@ struct thread_state { /* thread ident flags */ int ident_flags = 0; /* call depth limit */ - std::size_t max_call_depth = 0; + std::size_t max_call_depth = 1024; /* current call depth */ std::size_t call_depth = 0; /* loop nesting level */