aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-24 13:39:08 +0000
committershirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-24 13:39:08 +0000
commit8ad8407e602b09f1ef4e4377a4ca78e4fafec580 (patch)
tree32f5db28f8d32186dd2f6c9931ebaffed1cb5a54
parent0e8807dba53cf37fd79f98fb0e088d6654ae4ba8 (diff)
downloadruby-8ad8407e602b09f1ef4e4377a4ca78e4fafec580.tar.gz
dl/cfunc.c: fix conversion of Bignum
* ext/dl/cfunc.c (rb_dlcfunc_call): fix conversion from Bignum to pointer. sizeof(DLSTACK_TYPE) is larger than sizeof(long) on Windows x64 and higher bits over sizeof(long) of DLSTACK_TYPE was zero even if a pointer value was over 32 bits which causes SEGV on DL::TestCPtr#test_to_ptr_io. Adding a cast solves the bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--ext/dl/cfunc.c2
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index bb966a03f9..b4831f6daa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Jun 24 22:04:02 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * ext/dl/cfunc.c (rb_dlcfunc_call): fix conversion from Bignum to
+ pointer. sizeof(DLSTACK_TYPE) is larger than sizeof(long) on
+ Windows x64 and higher bits over sizeof(long) of DLSTACK_TYPE was
+ zero even if a pointer value was over 32 bits which causes SEGV on
+ DL::TestCPtr#test_to_ptr_io. Adding a cast solves the bug.
+
Mon Jun 24 22:04:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
* eval_error.c (warn_printf): use rb_vsprintf instead so ruby specific
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c
index 076f71ae25..46a26be7b8 100644
--- a/ext/dl/cfunc.c
+++ b/ext/dl/cfunc.c
@@ -372,7 +372,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
rb_big_pack(arg, ls, sizeof(ls)/sizeof(*ls));
d = 0;
for (j = 0; j < (int)(sizeof(ls)/sizeof(*ls)); j++)
- d |= ls[j] << (j * sizeof(long) * CHAR_BIT);
+ d |= (DLSTACK_TYPE)ls[j] << (j * sizeof(long) * CHAR_BIT);
stack[i] = d;
}
else {