summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-26 10:39:49 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-26 10:39:49 +0000
commita1f0c1878757b121f02562b88e206da026b23fbd (patch)
tree3137398e82d7e8c97285735f23cb4f7d8e96df8c
parentfbb78cbe68b30b8bbff6a6727d7b77e2c9f49d00 (diff)
downloadruby-a1f0c1878757b121f02562b88e206da026b23fbd.tar.gz
ruby-a1f0c1878757b121f02562b88e206da026b23fbd.tar.xz
ruby-a1f0c1878757b121f02562b88e206da026b23fbd.zip
* eval.c (eval): fix to check stack overflow.
* eval_intern.h, vm.h: move CHECK_STACK_OVERFLOW() macro. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--eval.c1
-rw-r--r--eval_intern.h6
-rw-r--r--vm.h6
4 files changed, 13 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 423302fcf..ff7ad9226 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Sep 26 19:36:26 2007 Koichi Sasada <ko1@atdot.net>
+
+ * eval.c (eval): fix to check stack overflow.
+
+ * eval_intern.h, vm.h: move CHECK_STACK_OVERFLOW() macro.
+
Wed Sep 26 19:27:11 2007 Koichi Sasada <ko1@atdot.net>
* insnhelper.ci (vm_throw): fix to move increment point.
diff --git a/eval.c b/eval.c
index 4ad528819..639010efd 100644
--- a/eval.c
+++ b/eval.c
@@ -1735,6 +1735,7 @@ eval(VALUE self, VALUE src, VALUE scope, const char *file, int line)
}
/* kick */
+ CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max);
result = vm_eval_body(th);
}
POP_TAG();
diff --git a/eval_intern.h b/eval_intern.h
index 3f4c81bf4..e5680a273 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -186,6 +186,12 @@ char *strrchr _((const char *, const char));
ruby_cref()->nd_visi = (f); \
}
+#define CHECK_STACK_OVERFLOW(cfp, margin) do \
+ if (((VALUE *)(cfp)->sp) + (margin) >= ((VALUE *)cfp)) { \
+ rb_exc_raise(sysstack_error); \
+ } \
+while (0)
+
void rb_thread_cleanup _((void));
void rb_thread_wait_other_threads _((void));
diff --git a/vm.h b/vm.h
index 02629e881..fa131d96e 100644
--- a/vm.h
+++ b/vm.h
@@ -214,12 +214,6 @@ default: \
((rb_control_frame_t *)(th->stack + th->stack_size) - (rb_control_frame_t *)(cfp))
#define VM_SP_CNT(th, sp) ((sp) - (th)->stack)
-#define CHECK_STACK_OVERFLOW(cfp, margin) do \
- if (((VALUE *)(cfp)->sp) + (margin) >= ((VALUE *)cfp)) { \
- rb_exc_raise(sysstack_error); \
- } \
-while (0)
-
/*
env{
env[0] // special (block or prev env)