summaryrefslogtreecommitdiff
path: root/randmt.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2002-12-27 21:50:16 +0100
committerKevin Ryde <user42@zip.com.au>2002-12-27 21:50:16 +0100
commit85990ac2090a90d480255fb0a3cfd5559a7c19cf (patch)
treee7a810b182304b180244a131631a766dd3545941 /randmt.c
parentafdc43a49843041b9a2d5cb15f4a32402ed9e514 (diff)
downloadgmp-85990ac2090a90d480255fb0a3cfd5559a7c19cf.tar.gz
2002-12-28 Pedro Gimeno <pggimeno@wanadoo.es>
* randmt.c (randseed_mt): Fix off-by-one bug on padding. Add ASSERT checking result of mpz_export.
Diffstat (limited to 'randmt.c')
-rw-r--r--randmt.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/randmt.c b/randmt.c
index 8313b1cff..fad7fa9bd 100644
--- a/randmt.c
+++ b/randmt.c
@@ -448,6 +448,8 @@ randseed_mt (gmp_randstate_t rstate, mpz_srcptr seed)
/* Split seed1 into N-1 32-bit chunks. */
mpz_export (&p->mt[1], &cnt, -1, sizeof (p->mt[1]), 0,
8 * sizeof (p->mt[1]) - 32, seed1);
+ cnt++;
+ ASSERT (cnt <= N);
while (cnt < N)
p->mt[cnt++] = 0;