aboutsummaryrefslogtreecommitdiffstats
path: root/eval_intern.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-18 13:47:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-18 13:47:56 +0000
commit340390093b1db331630d227edbd0f32d2d2b882a (patch)
tree8c6df9ffe3d20d2d40fb3cadb1a29877521adc87 /eval_intern.h
parent53953eee7c837541ad95e92bcda6ea3fd7f9ff34 (diff)
downloadruby-340390093b1db331630d227edbd0f32d2d2b882a.tar.gz
eval_intern.h: refine stack overflow detection
* eval_intern.h (TH_PUSH_TAG, TH_EXEC_TAG): refine stack overflow detection. chain local tag after setjmp() successed on it, because calling setjmp() also can overflow the stack. [ruby-dev:47804] [Bug #9109] * vm_eval.c (rb_catch_obj): now th->tag points previous tag until TH_EXEC_TAG(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_intern.h')
-rw-r--r--eval_intern.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/eval_intern.h b/eval_intern.h
index cf7fb23197..e32eafe2a8 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -95,8 +95,7 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
rb_thread_t * const _th = (th); \
struct rb_vm_tag _tag; \
_tag.tag = 0; \
- _tag.prev = _th->tag; \
- _th->tag = &_tag;
+ _tag.prev = _th->tag;
#define TH_POP_TAG() \
_th->tag = _tag.prev; \
@@ -129,7 +128,7 @@ rb_threadptr_tag_jump(rb_thread_t *th, int st)
[ISO/IEC 9899:1999] 7.13.1.1
*/
#define TH_EXEC_TAG() \
- (ruby_setjmp(_th->tag->buf) ? rb_threadptr_tag_state(_th) : 0)
+ (ruby_setjmp(_tag.buf) ? rb_threadptr_tag_state(_th) : (_th->tag = &_tag, 0))
#define EXEC_TAG() \
TH_EXEC_TAG()