diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-03 05:48:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-03 05:48:55 +0000 |
commit | 13424f32fe761c8b10bd86ac8ebc2d88a21da268 (patch) | |
tree | ff888af9208d086d9b740b7b4a04304eaf3034b0 /ext/tk/tcltklib.c | |
parent | f71dcc1b542fc0389e4a7cf05ac4b59e8197a998 (diff) | |
download | ruby-13424f32fe761c8b10bd86ac8ebc2d88a21da268.tar.gz |
* ext/tk/tcltklib.c (ip_ruby_cmd, ip_invoke_with_position): must
not access internal union directly. [ruby-list:45670]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/tcltklib.c')
-rw-r--r-- | ext/tk/tcltklib.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c index 34b66f76e6..dadab2f221 100644 --- a/ext/tk/tcltklib.c +++ b/ext/tk/tcltklib.c @@ -3090,21 +3090,19 @@ ip_ruby_cmd(clientData, interp, argc, argv) /* get args */ args = rb_ary_new2(argc - 2); for(i = 3; i < argc; i++) { + VALUE s; #if TCL_MAJOR_VERSION >= 8 str = Tcl_GetStringFromObj(argv[i], &len); - DUMP2("arg:%s",str); -#ifndef HAVE_STRUCT_RARRAY_LEN - rb_ary_push(args, rb_tainted_str_new(str, len)); -#else - RARRAY(args)->as.heap.ptr[RARRAY(args)->as.heap.len++] = rb_tainted_str_new(str, len); -#endif + s = rb_tainted_str_new(str, len); #else /* TCL_MAJOR_VERSION < 8 */ - DUMP2("arg:%s",argv[i]); + str = argv[i]; + s = rb_tainted_str_new2(str); +#endif + DUMP2("arg:%s",str); #ifndef HAVE_STRUCT_RARRAY_LEN - rb_ary_push(args, rb_tainted_str_new2(argv[i])); + rb_ary_push(args, s); #else - RARRAY(args)->as.heap.ptr[RARRAY(args)->as.heap.len++] = rb_tainted_str_new2(argv[i]); -#endif + RARRAY(args)->ptr[RARRAY(args)->len++] = s; #endif } @@ -8295,7 +8293,7 @@ ip_invoke_with_position(argc, argv, obj, position) DUMP2("back from handler (current thread:%lx)", current); /* get result & free allocated memory */ - ret = RARRAY(result)->as.heap.ptr[0]; + ret = RARRAY_PTR(result)[0]; #if 0 /* use Tcl_EventuallyFree */ Tcl_EventuallyFree((ClientData)alloc_done, TCL_DYNAMIC); /* XXXXXXXX */ #else |