public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/31798] pidfd_getpid.c is miscompiled by GCC 6.4
Date: Mon, 27 May 2024 13:53:26 +0000	[thread overview]
Message-ID: <bug-31798-131-0DYs33uA7B@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31798-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31798

--- Comment #2 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f981bf6b9db87e0732b46bfe92fdad4d363225e8

commit f981bf6b9db87e0732b46bfe92fdad4d363225e8
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 25 05:13:41 2024 -0700

    parse_fdinfo: Don't advance pointer twice [BZ #31798]

    pidfd_getpid.c has

          /* Ignore invalid large values.  */
          if (INT_MULTIPLY_WRAPV (10, n, &n)
              || INT_ADD_WRAPV (n, *l++ - '0', &n))
            return -1;

    For GCC older than GCC 7, INT_ADD_WRAPV(a, b, r) is defined as

       _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW)

    and *l++ - '0' is evaluated twice.  Fix BZ #31798 by moving "l++" out of
    the if statement.  Tested with GCC 6.4 and GCC 14.1.

    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2024-05-27 13:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-25 11:03 [Bug libc/31798] New: " hjl.tools at gmail dot com
2024-05-25 12:00 ` [Bug libc/31798] " hjl.tools at gmail dot com
2024-05-25 12:08 ` hjl.tools at gmail dot com
2024-05-26  7:12 ` sam at gentoo dot org
2024-05-27 13:53 ` cvs-commit at gcc dot gnu.org [this message]
2024-05-27 14:42 ` cvs-commit at gcc dot gnu.org
2024-05-27 14:42 ` hjl.tools at gmail dot com

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-31798-131-0DYs33uA7B@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.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: link
Be 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).