aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-11 05:09:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-11 05:09:58 +0000
commitaf310963abb1ef737d52b29ec77f6598ac505472 (patch)
treed26d7ec10ff4d62bee1958f6b4d1c43005c3d507
parent9cc7e9d1e8cea421808340ac2ccbc0c484b527fc (diff)
downloadruby-af310963abb1ef737d52b29ec77f6598ac505472.tar.gz
* ext/bigdecimal/bigdecimal.c (PUSH): to prevent VALUE from GC,
must not cast it to unsigned long, which may be shorter than VALUE, and the result can be mere garbage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--ext/bigdecimal/bigdecimal.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d76091029..22a59c767a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri May 11 14:09:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (PUSH): to prevent VALUE from GC,
+ must not cast it to unsigned long, which may be shorter than
+ VALUE, and the result can be mere garbage.
+
Fri May 11 09:51:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/test/unit.rb (Test::Unit::Runner#failed): no unnecessary
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index a2d705ce20..e5f8545991 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -61,7 +61,7 @@ static ID id_eq;
/* MACRO's to guard objects from GC by keeping them in stack */
#define ENTER(n) volatile VALUE vStack[n];int iStack=0
-#define PUSH(x) vStack[iStack++] = (unsigned long)(x);
+#define PUSH(x) vStack[iStack++] = (VALUE)(x);
#define SAVE(p) PUSH(p->obj);
#define GUARD_OBJ(p,y) {p=y;SAVE(p);}