diff options
author | Kai Tietz <ktietz@gcc.gnu.org> | 2013-01-31 09:17:58 +0100 |
---|---|---|
committer | Kai Tietz <ktietz@gcc.gnu.org> | 2013-01-31 09:17:58 +0100 |
commit | 1d77deec05e3401fba2cca8e7907c2a27f2bdeed (patch) | |
tree | 49c6f180c850d0464caca7e25defd0f5de196ac3 /libiberty | |
parent | 4cfc6e54ba9dd2f53da6e679224706e2fbb0e66e (diff) | |
download | gcc-1d77deec05e3401fba2cca8e7907c2a27f2bdeed.zip gcc-1d77deec05e3401fba2cca8e7907c2a27f2bdeed.tar.gz gcc-1d77deec05e3401fba2cca8e7907c2a27f2bdeed.tar.bz2 |
re PR other/54620 (sha1.c has incorrect math if sizeof(size_t) is 8)
PR other/54620
* sha1.c (sha1_process_block): Handle case that size_t is
a wider-integer-scalar as a 32-bit unsigned integer.
From-SVN: r195604
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/sha1.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libiberty/sha1.c b/libiberty/sha1.c index 6a25ab2..617e743 100644 --- a/libiberty/sha1.c +++ b/libiberty/sha1.c @@ -300,8 +300,7 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx) length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ ctx->total[0] += len; - if (ctx->total[0] < len) - ++ctx->total[1]; + ctx->total[1] += ((len >> 31) >> 1) + (ctx->total[0] < len); #define rol(x, n) (((x) << (n)) | ((sha1_uint32) (x) >> (32 - (n)))) |