public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/110239] [14 regression] std/format/functions/format.cc fails after r14-1648-g628ba410b9265d
Date: Mon, 26 Jun 2023 16:43:40 +0000	[thread overview]
Message-ID: <bug-110239-4-JJP6Bddc0o@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110239-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110239

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:3bb9f9329c378934541ae4cff9977b7487e97cf0

commit r14-2105-g3bb9f9329c378934541ae4cff9977b7487e97cf0
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Jun 26 14:46:46 2023 +0100

    libstdc++: Fix std::format for pointers [PR110239]

    The formatter for pointers was casting to uint64_t which sign extends a
    32-bit pointer and produces a value that won't fit in the provided
    buffer. Cast to uintptr_t instead.

    There was also a bug in the __parse_integer helper when converting a
    wide string to a narrow string in order to use std::from_chars on it.
    The function would always try to read 32 characters, even if the format
    string was shorter than that. Fix that bug, and remove the constexpr
    implementation of __parse_integer by just using __from_chars_alnum
    instead of from_chars, because that's usable in constexpr even in
    C++20.

    libstdc++-v3/ChangeLog:

            PR libstdc++/110239
            * include/std/format (__format::__parse_integer): Fix buffer
            overflow for wide chars.
            (formatter<const void*, C>::format): Cast to uintptr_t instead
            of uint64_t.
            * testsuite/std/format/string.cc: Test too-large widths.

  parent reply	other threads:[~2023-06-26 16:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13 15:27 [Bug other/110239] New: " seurer at gcc dot gnu.org
2023-06-14  4:29 ` [Bug other/110239] " redi at gcc dot gnu.org
2023-06-23 18:36 ` redi at gcc dot gnu.org
2023-06-26 13:36 ` redi at gcc dot gnu.org
2023-06-26 16:43 ` cvs-commit at gcc dot gnu.org [this message]
2023-06-26 16:45 ` [Bug libstdc++/110239] " redi at gcc dot gnu.org
2023-06-29 23:01 ` cvs-commit 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-110239-4-JJP6Bddc0o@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: 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).