aboutsummaryrefslogtreecommitdiffstats
path: root/process.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-06 22:58:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-06 22:58:03 +0000
commit85365445de966ffdd1ddf6a7a735a564beefd762 (patch)
tree2a447cca4fda4dc219a53e6ecf90575e0156e680 /process.c
parent386016adc642dc89865f1feb04000674b68d6f01 (diff)
downloadruby-85365445de966ffdd1ddf6a7a735a564beefd762.tar.gz
process.c: argument types over conversion
* process.c (rb_exec_getargs): honor the expected argument types over the conversion method. the basic language functionality should be robust. [ruby-core:75388] [Bug #12355] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/process.c b/process.c
index 6f3fc235f2..75f51c8a76 100644
--- a/process.c
+++ b/process.c
@@ -1986,12 +1986,24 @@ rb_check_argv(int argc, VALUE *argv)
}
static VALUE
+check_hash(VALUE obj)
+{
+ if (RB_SPECIAL_CONST_P(obj)) return Qnil;
+ switch (RB_BUILTIN_TYPE(obj)) {
+ case T_STRING:
+ case T_ARRAY:
+ return Qnil;
+ }
+ return rb_check_hash_type(obj);
+}
+
+static VALUE
rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, VALUE *opthash_ret)
{
VALUE hash, prog;
if (0 < *argc_p) {
- hash = rb_check_hash_type((*argv_p)[*argc_p-1]);
+ hash = check_hash((*argv_p)[*argc_p-1]);
if (!NIL_P(hash)) {
*opthash_ret = hash;
(*argc_p)--;
@@ -1999,7 +2011,7 @@ rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, V
}
if (0 < *argc_p) {
- hash = rb_check_hash_type((*argv_p)[0]);
+ hash = check_hash((*argv_p)[0]);
if (!NIL_P(hash)) {
*env_ret = hash;
(*argc_p)--;