diff options
author | ktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-31 08:17:58 +0000 |
---|---|---|
committer | ktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-31 08:17:58 +0000 |
commit | 5e6e281137cd32ff309b2b691d7860c408414541 (patch) | |
tree | 49c6f180c850d0464caca7e25defd0f5de196ac3 /libiberty/sha1.c | |
parent | f55ee54f7214bb23e1f0009af716df58a58ed6bc (diff) | |
download | gcc-5e6e281137cd32ff309b2b691d7860c408414541.tar.gz |
PR other/54620
* sha1.c (sha1_process_block): Handle case that size_t is
a wider-integer-scalar as a 32-bit unsigned integer.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195604 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/sha1.c')
-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 6a25ab23992..617e743a15e 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)))) |