ruby-changes:39214
From: nobu <ko1@a...>
Date: Sun, 19 Jul 2015 09:26:06 +0900 (JST)
Subject: [ruby-changes:39214] nobu:r51295 (trunk): eval.c: check tag value
nobu 2015-07-19 09:25:45 +0900 (Sun, 19 Jul 2015) New Revision: 51295 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51295 Log: eval.c: check tag value * eval.c (rb_jump_tag): paranoiac check of tag value. Modified files: trunk/eval.c trunk/eval_error.c Index: eval_error.c =================================================================== --- eval_error.c (revision 51294) +++ eval_error.c (revision 51295) @@ -258,6 +258,9 @@ sysexit_status(VALUE err) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L258 return NUM2INT(st); } +#define unknown_longjmp_status(status) \ + rb_bug("Unknown longjmp status %d", status) + static int error_handle(int ex) { @@ -314,7 +317,7 @@ error_handle(int ex) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L317 error_print(); break; default: - rb_bug("Unknown longjmp status %d", ex); + unknown_longjmp_status(ex); break; } rb_threadptr_reset_raised(th); Index: eval.c =================================================================== --- eval.c (revision 51294) +++ eval.c (revision 51295) @@ -755,6 +755,9 @@ rb_raise_jump(VALUE mesg, VALUE cause) https://github.com/ruby/ruby/blob/trunk/eval.c#L755 void rb_jump_tag(int tag) { + if (UNLIKELY(tag < TAG_RETURN || tag > TAG_FATAL)) { + unknown_longjmp_status(tag); + } JUMP_TAG(tag); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/