# Limited_big_rand \$B\$G(B SEGV \$B\$,H/@8\$9\$k2DG=@-(B

e\$B\$`\$i\$?\$G\$9!%e(B

random.c e\$B\$GDj5A\$5\$l\$F\$\$\$ke(B limited_big_rand e\$BFb\$G!\$e(B
SIZEOF_BDIGITS == 2 e\$B\$N\$H\$-\$Ke(B Segmentation Fault
e\$B\$,H/@8\$9\$k2DG=@-\$,\$"\$j\$^\$9!%e(B
e\$B%a!<%k\$N:G8e\$K=\$@5%Q%C%A\$rE:IU\$7\$^\$9!%e(B

e\$B\$H\$3\$m\$G!\$e(B[ruby-dev:30954]
e\$B\$+\$i;O\$^\$kMp?t@[email protected]\$N;EMM\$NOC\$,\$H\$F\$b5\$\$K\$J\$C\$F\$\$\$^\$9!%e(B
e\$B8=>u\$O\$I\$N\$h\$&\$K\$J\$C\$F\$\$\$k\$N\$G\$7\$g\$&!)8&5f\$GMp?t\$rNI\$/;HMQ\$9\$k\$N\$G!\$e(B
e\$B;d\$b5DO@\$K:.\$<\$F\$\$\$?\$@\$1\$k\$HBgJQ4r\$7\$\$\$G\$9!%e(B

Kenta M.
OpenPGP FP = FA26 35D7 4F98 3498 0810 E0D5 F213 966F E9EB 0BCC

diff --git a/random.c b/random.c
index 9bcc3b9…e59a0b2 100644
— a/random.c
+++ b/random.c
@@ -386,10 +386,10 @@ limited_big_rand(struct RBignum *limit)
RBIGNUM_SET_SIGN(val, 1);
#if SIZEOF_BDIGITS == 2

# define BIG_GET32(big,i) (RBIGNUM_DIGITS(big)[(i)*2] | \

• ``````                      ((i)*2+1 < RBIGNUM_DIGITS(big) ?
``````

(RBIGNUM_DIGITS(big)[(i)*2+1] << 16) \

• ``````                      ((i)*2+1 < RBIGNUM_LEN(big) ?
``````

(RBIGNUM_DIGITS(big)[(i)*2+1] << 16)
: 0))

# define BIG_SET32(big,i,d) ((RBIGNUM_DIGITS(big)[(i)*2] = (d) &

0xffff), \

• ``````                        ((i)*2+1 < RBIGNUM_DIGITS(big) ?
``````

(RBIGNUM_DIGITS(big)[(i)*2+1] = (d) >> 16) \

• ``````                        ((i)*2+1 < RBIGNUM_LEN(big) ?
``````

(RBIGNUM_DIGITS(big)[(i)2+1] = (d) >> 16)
: 0))
#else
/
SIZEOF_BDIGITS == 4 */

In article [email protected],
“Kenta M.” [email protected] writes:

random.c e\$B\$GDj5A\$5\$l\$F\$\$\$ke(B limited_big_rand e\$BFb\$G!\$e(B
SIZEOF_BDIGITS == 2 e\$B\$N\$H\$-\$Ke(B Segmentation Fault e\$B\$,H/@8\$9\$k2DG=@-\$,\$"\$j\$^\$9!%e(B
e\$B%a!<%k\$N:G8e\$K=\$@5%Q%C%A\$rE:IU\$7\$^\$9!%e(B

e\$B\$?\$7\$+\$K!#e(B
e\$B%3%_%C%H\$7\$F\$*\$-\$^\$7\$?!#e(B

e\$B\$H\$3\$m\$G!\$e(B[ruby-dev:30954] e\$B\$+\$i;O\$^\$kMp?t@[email protected]\$N;EMM\$NOC\$,\$H\$F\$b5\$\$K\$J\$C\$F\$\$\$^\$9!%e(B
e\$B8=>u\$O\$I\$N\$h\$&\$K\$J\$C\$F\$\$\$k\$N\$G\$7\$g\$&!)8&5f\$GMp?t\$rNI\$/;HMQ\$9\$k\$N\$G!\$e(B
e\$B;d\$b5DO@\$K:.\$<\$F\$\$\$?\$@\$1\$k\$HBgJQ4r\$7\$\$\$G\$9!%e(B

e\$B?J\$a\$k?M\$,0l?M\$b\$\$\$J\$1\$l\$P?J\$^\$J\$\$\$H\$\$\$&>u67\$G\$9\$+\$M\$'!#e(B