cap default recursion limit at 1024

master
Daniel Kolesa 2021-05-08 21:41:13 +02:00
parent 201d6031b0
commit 6e779f827f
2 changed files with 3 additions and 3 deletions

View File

@ -420,13 +420,13 @@ struct LIBCUBESCRIPT_EXPORT state {
/** @brief Get the maximum call depth of the VM /** @brief Get the maximum call depth of the VM
* *
* If zero, it is unlimited, otherwise it specifies how much the VM is * 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; std::size_t max_call_depth() const;
/** @brief Set the maximum call depth ov the VM /** @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 * the VM is allowed to recurse if you have specific constraints to adhere
* to. * to.
* *

View File

@ -36,7 +36,7 @@ struct thread_state {
/* thread ident flags */ /* thread ident flags */
int ident_flags = 0; int ident_flags = 0;
/* call depth limit */ /* call depth limit */
std::size_t max_call_depth = 0; std::size_t max_call_depth = 1024;
/* current call depth */ /* current call depth */
std::size_t call_depth = 0; std::size_t call_depth = 0;
/* loop nesting level */ /* loop nesting level */