From 26630aa2019300948440f957db657165712a932d Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Thu, 7 Feb 2013 04:43:35 +0000 Subject: merge from gcc --- libiberty/ChangeLog | 6 +++++- libiberty/sha1.c | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'libiberty') diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 2a91c419dde..cbcd1e25948 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,6 +1,10 @@ 2013-01-31 Kai Tietz - PR other/543413 + PR other/54620 + * sha1.c (sha1_process_block): Handle case that size_t is + a wider-integer-scalar as a 32-bit unsigned integer. + + PR other/53413 * md5.c (md5_process_block): Handle case that size_t is a wider-integer-scalar a 32-bit unsigned integer. 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)))) -- cgit v1.2.1