From 2dd293c0f94fb9240dfd714f419bcce5df2ea4dc Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Fri, 22 Nov 2013 06:37:57 -0800 Subject: [PATCH] [workaround] add stack overflow detector --- src/vm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vm.c b/src/vm.c index c8ef10a9..564c44b2 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -301,7 +302,7 @@ pic_apply_argv(pic_state *pic, struct pic_proc *proc, size_t argc, ...) # define VM_LOOP_END } } #endif -#define PUSH(v) (*pic->sp++ = (v)) +#define PUSH(v) ((pic->sp >= pic->stend) ? abort() : (*pic->sp++ = (v))) #define POP() (*--pic->sp) #define POPN(i) (pic->sp -= (i))