зеркало из https://github.com/github/ruby.git
fatal error if variable argument length mismatch
* include/ruby/ruby.h (rb_scan_args0): raise fatal error if variable argument length does not match, it is a bug in the code which uses rb_scan_args, not a runtime error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
4a574f7ad9
Коммит
14c43e2be6
|
@ -1,3 +1,9 @@
|
|||
Mon May 23 12:47:09 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* include/ruby/ruby.h (rb_scan_args0): raise fatal error if
|
||||
variable argument length does not match, it is a bug in the code
|
||||
which uses rb_scan_args, not a runtime error.
|
||||
|
||||
Mon May 23 12:30:29 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): consider
|
||||
|
|
|
@ -2203,6 +2203,12 @@ rb_scan_args0(int argc, const VALUE *argv, const char *fmt, int varc, VALUE *var
|
|||
}
|
||||
n_mand = n_lead + n_trail;
|
||||
|
||||
vari = n_mand + n_opt + f_var + f_hash + f_block;
|
||||
if (vari != varc) {
|
||||
rb_fatal("variable argument length doesn't match* %d %d", vari, varc);
|
||||
}
|
||||
vari = 0;
|
||||
|
||||
if (argc < n_mand)
|
||||
goto argc_error;
|
||||
|
||||
|
@ -2282,9 +2288,6 @@ rb_scan_args0(int argc, const VALUE *argv, const char *fmt, int varc, VALUE *var
|
|||
argc_error:
|
||||
rb_error_arity(argc, n_mand, f_var ? UNLIMITED_ARGUMENTS : n_mand + n_opt);
|
||||
}
|
||||
if (vari != varc) {
|
||||
rb_raise(rb_eRuntimeError, "variable argument length doesn't match* %d %d", vari, varc);
|
||||
}
|
||||
|
||||
return argc;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче