Project

General

Profile

Bug #4223 » patch-bug4223.txt

metanest (Makoto Kishimoto), 07/13/2011 09:48 AM

 
1
diff --git bignum.c bignum.c
2
index 809b164..9c289f7 100644
3
--- bignum.c
4
+++ bignum.c
5
@@ -1767,6 +1767,7 @@ bigsub_int(VALUE x, long y0)
6
     if (xn == 1 && num < 0) {
7
 	RBIGNUM_SET_SIGN(z, !RBIGNUM_SIGN(x));
8
 	zds[0] = (BDIGIT)-num;
9
+	RB_GC_GUARD(x);
10
 	return bignorm(z);
11
     }
12
     zds[0] = BIGLO(num);
13
@@ -1793,6 +1794,7 @@ bigsub_int(VALUE x, long y0)
14
     if (num < 0) {
15
 	z = bigsub(x, rb_int2big(y0));
16
     }
17
+    RB_GC_GUARD(x);
18
     return bignorm(z);
19
 }
20
 
21
@@ -1845,6 +1847,7 @@ bigadd_int(VALUE x, long y)
22
     while (i < zn) {
23
 	zds[i++] = 0;
24
     }
25
+    RB_GC_GUARD(x);
26
     return bignorm(z);
27
 }
28