From: Jim Meyering Date: Sat, 10 Dec 2005 21:58:23 +0000 (+0000) Subject: Avoid shred segfault on 64-bit systems. X-Git-Tag: v6.0~1157 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dfacfaf971dedb558a82c5e04601150fda53312c;p=thirdparty%2Fcoreutils.git 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. --- diff --git a/src/rand-isaac.c b/src/rand-isaac.c index 8450ae830a..de90168c4c 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; }