public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: libc-alpha@sourceware.org
Subject: gcvt(3) is documented as MT-Safe, AS-Safe, AC-Safe
Date: Wed, 1 May 2024 17:18:22 +0200	[thread overview]
Message-ID: <ZjJdPgvS7X_p5pHd@debian> (raw)

[-- Attachment #1: Type: text/plain, Size: 631 bytes --]

Hi,

gcvt(3) is documented as being MT-, AS-, and AC-Safe.  However, the
following code calls sprintf(3), which is not safe.

	$ grepc __GCVT .
	./misc/efgcvt-template.c:char *
	__GCVT (FLOAT_TYPE value, int ndigit, char *buf)
	{
	  SPRINTF (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value);
	  return buf;
	}
	./misc/qefgcvt.c:#define __GCVT __qgcvt
	./misc/efgcvt.c:#define __GCVT __gcvt
	./sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c:#define __GCVT ___qgcvtieee128

Is that subset of sprintf(3) functionality safe?

Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

                 reply	other threads:[~2024-05-01 15:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=ZjJdPgvS7X_p5pHd@debian \
    --to=alx@kernel.org \
    --cc=libc-alpha@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).