OSDN Git Service

Merged from trunk.
authorktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 Jan 2013 08:15:57 +0000 (08:15 +0000)
committerktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 Jan 2013 08:15:57 +0000 (08:15 +0000)
PR other/543413
* md5.c (md5_process_block):  Handle case that size_t is
a wider-integer-scalar a 32-bit unsigned integer.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@195602 138bc75d-0d04-0410-961f-82ee72b054a4

libiberty/ChangeLog
libiberty/md5.c

index 60850da..6190eab 100644 (file)
@@ -1,4 +1,10 @@
 2013-01-31  Kai Tietz  <ktietz@redhat.com>
 2013-01-31  Kai Tietz  <ktietz@redhat.com>
+
+       Merged from trunk.
+       PR other/543413
+       * md5.c (md5_process_block):  Handle case that size_t is
+       a wider-integer-scalar a 32-bit unsigned integer.
+
         2012-07-31  Mike Frysinger  <vapier@gentoo.org>
 
        Merged from trunk.
         2012-07-31  Mike Frysinger  <vapier@gentoo.org>
 
        Merged from trunk.
index 8cc0cb5..b30a6b7 100644 (file)
@@ -293,8 +293,7 @@ md5_process_block (const void *buffer, size_t len, struct md5_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;
      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);
 
   /* Process all bytes in the buffer with 64 bytes in each round of
      the loop.  */
 
   /* Process all bytes in the buffer with 64 bytes in each round of
      the loop.  */