mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
4a574f7ad9
commit
14c43e2be6
2 changed files with 12 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue