From: Alejandro Colomar <alx.manpages@gmail.com>
To: Yedidyah Bar David <didi@redhat.com>
Cc: linux-man@vger.kernel.org, Alejandro Colomar <alx@kernel.org>
Subject: Re: [PATCH] isalpha.3: behavior is undefined if c is out-of-range
Date: Mon, 5 Jun 2023 13:33:10 +0200 [thread overview]
Message-ID: <14cbb4e3-9302-8065-2320-978181fbede0@gmail.com> (raw)
In-Reply-To: <CAHRwYXsxK-vyOLpDXk7V5F0fvit7O2s0Dj28M5aqXh8vxLdChA@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1568 bytes --]
Hi Yedidyah,
On 6/5/23 13:17, Yedidyah Bar David wrote:
> Clarify that the behavior of these functions is undefined if c is
> neither in the unsigned char range nor EOF.
>
> I copied the added text from toupper.3.
>
> In practice, calling them on out-of-range values - tested with recent
> glibc/gcc - is simply reading from random process memory - meaning, you
> either get some garbage, if the memory was readable, or a segmentation
> fault. See also:
>
> https://stackoverflow.com/questions/65514890/glibcs-isalpha-function-and-the-en-us-utf-8-locale
>
> Signed-off-by: Yedidyah Bar David <didi@redhat.com>
This is already covered by the NOTES section, isn't it? BTW, I'll
rename that section to CAVEATS.
Thanks,
Alex
> ---
> man3/isalpha.3 | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/man3/isalpha.3 b/man3/isalpha.3
> index 443c2aa09..8ad997c29 100644
> --- a/man3/isalpha.3
> +++ b/man3/isalpha.3
> @@ -145,6 +145,15 @@ is the special locale object
> .BR duplocale (3))
> or is not a valid locale object handle.
> .PP
> +If
> +.I c
> +is neither an
> +.I "unsigned char"
> +value nor
> +.BR EOF ,
> +the behavior of these functions
> +is undefined.
> +.PP
> The list below explains the operation of the functions without
> the "_l" suffix;
> the functions with the "_l" suffix differ only in using the locale object
> --
> 2.31.1
>
> Best regards,
> --
> Didi
>
--
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-06-05 11:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 11:17 [PATCH] isalpha.3: behavior is undefined if c is out-of-range Yedidyah Bar David
2023-06-05 11:33 ` Alejandro Colomar [this message]
2023-06-05 11:38 ` [PATCH v1b] isalpha.3: Move NOTES to CAVEATS, and clarify some Undefined Behavior Alejandro Colomar
2023-06-05 11:41 ` Sam James
2023-06-05 12:43 ` Yedidyah Bar David
2023-06-05 12:09 ` [PATCH v2alx] " Alejandro Colomar
2023-06-05 12:34 ` [PATCH] isalpha.3: behavior is undefined if c is out-of-range Yedidyah Bar David
2023-06-05 13:15 ` Alejandro Colomar
2023-06-05 13:17 ` Alejandro Colomar
2023-06-05 13:29 ` Yedidyah Bar David
2023-06-13 14:07 ` Yedidyah Bar David
2023-07-08 18:42 ` Alejandro Colomar
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=14cbb4e3-9302-8065-2320-978181fbede0@gmail.com \
--to=alx.manpages@gmail.com \
--cc=alx@kernel.org \
--cc=didi@redhat.com \
--cc=linux-man@vger.kernel.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