public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pikegadgets+gcc at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug other/54620] New: sha1.c has incorrect math if sizeof(size_t) is 8 Date: Tue, 18 Sep 2012 17:22:00 -0000 [thread overview] Message-ID: <bug-54620-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54620 Bug #: 54620 Summary: sha1.c has incorrect math if sizeof(size_t) is 8 Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned@gcc.gnu.org ReportedBy: pikegadgets+gcc@gmail.com In libiberty/sha1.*, I don't see anything saying that sha1_process_block() has a size limit on its input buffer, and if the length of the buffer is big (e.g., 2^32 on a 64-bit machine) then this code won't correctly add a 64-bit number to 64-bit number: /* First increment the byte count. RFC 1321 specifies the possible 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]; The above is at sha1.c around line 302. Also, Florian Weimer pointed out that code nearby uses "len & ~63" when it perhaps should use something like "len & (~(size_t)63)". Similar bug(s) are in md5.*. See bug 39064 for details.
next reply other threads:[~2012-09-18 17:22 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-09-18 17:22 pikegadgets+gcc at gmail dot com [this message] 2012-09-18 18:06 ` [Bug other/54620] " schwab@linux-m68k.org 2013-01-30 10:42 ` ktietz at gcc dot gnu.org 2013-01-30 16:51 ` ktietz at gcc dot gnu.org 2013-01-30 16:57 ` ktietz at gcc dot gnu.org 2013-01-30 16:58 ` ktietz at gcc dot gnu.org 2013-01-31 8:18 ` ktietz at gcc dot gnu.org 2013-01-31 8:18 ` ktietz at gcc dot gnu.org 2013-01-31 8:19 ` ktietz at gcc dot gnu.org 2013-01-31 8:23 ` ktietz at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-54620-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).