mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Limit ecall() depth to 32 (default).
This commit is contained in:
@@ -53,6 +53,11 @@ void abort(void);
|
||||
#define MRB_FUNCALL_DEPTH_MAX 512
|
||||
#endif
|
||||
|
||||
/* Maximum depth of ecall() recursion. */
|
||||
#ifndef MRB_ECALL_DEPTH_MAX
|
||||
#define MRB_ECALL_DEPTH_MAX 32
|
||||
#endif
|
||||
|
||||
/* Maximum stack depth. Should be set lower on memory constrained systems.
|
||||
The value below allows about 60000 recursive calls in the simplest case. */
|
||||
#ifndef MRB_STACK_MAX
|
||||
@@ -319,7 +324,7 @@ ecall(mrb_state *mrb)
|
||||
int nregs;
|
||||
|
||||
if (i<0) return;
|
||||
if (ci - c->cibase > MRB_FUNCALL_DEPTH_MAX) {
|
||||
if (ci - c->cibase > MRB_ECALL_DEPTH_MAX) {
|
||||
mrb_exc_raise(mrb, mrb_obj_value(mrb->stack_err));
|
||||
}
|
||||
p = c->ensure[i];
|
||||
|
||||
Reference in New Issue
Block a user