summaryrefslogtreecommitdiff
path: root/src/rand-isaac.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-12-10 21:58:23 +0000
committerJim Meyering <jim@meyering.net>2005-12-10 21:58:23 +0000
commitdfacfaf971dedb558a82c5e04601150fda53312c (patch)
tree953ae14f1dc78d9b5186f8210621a1a753a6f255 /src/rand-isaac.c
parent31998924885cd3dcf8703ed17747173c8eee016f (diff)
downloadcoreutils-dfacfaf971dedb558a82c5e04601150fda53312c.tar.xz
Avoid shred segfault on 64-bit systems.
(isaac_refill): Don't try to negate a local of type uint32_t. Convert it to int32_t first.
Diffstat (limited to 'src/rand-isaac.c')
-rw-r--r--src/rand-isaac.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/rand-isaac.c b/src/rand-isaac.c
index 8450ae830..de90168c4 100644
--- a/src/rand-isaac.c
+++ b/src/rand-isaac.c
@@ -105,15 +105,18 @@ isaac_refill (struct isaac_state *s, uint32_t r[/* s>-words */])
r += 4;
}
while ((m += 4) < s->mm + w / 2);
+
do
{
- isaac_step (s, a << 13, a, b, m, -w / 2, r);
- isaac_step (s, a >> 6, a, b, m + 1, -w / 2, r + 1);
- isaac_step (s, a << 2, a, b, m + 2, -w / 2, r + 2);
- isaac_step (s, a >> 16, a, b, m + 3, -w / 2, r + 3);
+ int32_t zz = w;
+ isaac_step (s, a << 13, a, b, m, -zz / 2, r);
+ isaac_step (s, a >> 6, a, b, m + 1, -zz / 2, r + 1);
+ isaac_step (s, a << 2, a, b, m + 2, -zz / 2, r + 2);
+ isaac_step (s, a >> 16, a, b, m + 3, -zz / 2, r + 3);
r += 4;
}
while ((m += 4) < s->mm + w);
+
s->a = a;
s->b = b;
}