[workaround] add stack overflow detector

This commit is contained in:
Yuichi Nishiwaki 2013-11-22 06:37:57 -08:00
parent 0a521c2314
commit 2dd293c0f9
1 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <limits.h> #include <limits.h>
#include <math.h> #include <math.h>
@ -301,7 +302,7 @@ pic_apply_argv(pic_state *pic, struct pic_proc *proc, size_t argc, ...)
# define VM_LOOP_END } } # define VM_LOOP_END } }
#endif #endif
#define PUSH(v) (*pic->sp++ = (v)) #define PUSH(v) ((pic->sp >= pic->stend) ? abort() : (*pic->sp++ = (v)))
#define POP() (*--pic->sp) #define POP() (*--pic->sp)
#define POPN(i) (pic->sp -= (i)) #define POPN(i) (pic->sp -= (i))