From patchwork Wed Jan 30 17:45:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 216998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 6F58B2C007C for ; Thu, 31 Jan 2013 09:10:32 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1360188632; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Date:Message-ID:Subject:From:To:Cc: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=dzSH6U5 pUobptdfm9dlYH1KrjNk=; b=Birk8s20wxVysJ2rnG86Y+FwSqpqMG4j7rma7Sk WEMplOXDvY/NRtLJrdfrqfU/Xdmc/NT6IXTzAjaRO0XnQJ39S7pIInE5sZdoHMDp AAeIwUHEHETTOK54rcZEUV3OCOWg/nXVTDa2FqkQGQ4S2b3WRyjXzjyAed2qSYJR NFiM= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:X-Received:Received:Date:Message-ID:Subject:From:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=xbfSrOvJC1p3OxqFC28GFht2JXETa0QKlnJaICEM3SLmr4i+AEs/s48naine1m mneq4DGY4GQWhhnuEEVoZ27lC2cSvcPjPKlUdb/6sVTYtNg46bvHYDrytN7lP37+ SUeoHAuRfBfGwNzGfVOOQHHDNJfNOoMw6GxWXOBIL28ds=; Received: (qmail 28819 invoked by alias); 30 Jan 2013 17:45:52 -0000 Received: (qmail 28405 invoked by uid 22791); 30 Jan 2013 17:45:38 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ia0-f181.google.com (HELO mail-ia0-f181.google.com) (209.85.210.181) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Jan 2013 17:45:32 +0000 Received: by mail-ia0-f181.google.com with SMTP id k25so2699342iah.12 for ; Wed, 30 Jan 2013 09:45:31 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.50.197.161 with SMTP id iv1mr4379997igc.53.1359567931351; Wed, 30 Jan 2013 09:45:31 -0800 (PST) Received: by 10.64.34.172 with HTTP; Wed, 30 Jan 2013 09:45:31 -0800 (PST) Date: Wed, 30 Jan 2013 18:45:31 +0100 Message-ID: Subject: [patch libiberty]: Fix PR 54620 From: Kai Tietz To: GCC Patches Cc: Binutils , gdb X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, this patch fixes wrong handling of cases that bitness of size_t is wider as 32-bit. ChangeLog 2013-01-30 Kai Tietz PR other/54620 * sha1.c (sha1_process_block): Handle case that size_t is a wider-integer-scalar as a 32-bit unsigned integer. Tested for x86_64-unknown-linux-gnu, i686-pc-cygwin, and x86_64-w64-mingw32. Ok for apply? Regards, Kai Index: sha1.c =================================================================== --- sha1.c (Revision 195578) +++ sha1.c (Arbeitskopie) @@ -300,8 +300,7 @@ sha1_process_block (const void *buffer, size_t 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); #define rol(x, n) (((x) << (n)) | ((sha1_uint32) (x) >> (32 - (n))))