public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Szabolcs Nagy <nsz@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/arm/morello/main] Fix OOB read in stdlib thousand separator handling Date: Wed, 12 Oct 2022 14:15:50 +0000 (GMT) [thread overview] Message-ID: <20221012141550.278373851165@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=85c6eba32a3c1f227ff89bbd23d6c97cdf76892b commit 85c6eba32a3c1f227ff89bbd23d6c97cdf76892b Author: Szabolcs Nagy <szabolcs.nagy@arm.com> Date: Tue Oct 11 15:24:41 2022 +0100 Fix OOB read in stdlib thousand separator handling __correctly_grouped_prefixmb only worked with thousands_len == 1, otherwise it read past the end of cp or thousands. Avoid OOB access by considering thousands_len when initializing cp. On morello with strict bounds checking this fixes FAIL: stdlib/tst-strtod4 FAIL: stdlib/tst-strtod5i both of which set cs_CZ.UTF-8 locale that has 3 byte thousands_len. Diff: --- stdlib/grouping.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stdlib/grouping.c b/stdlib/grouping.c index be7922f5fd..4622897488 100644 --- a/stdlib/grouping.c +++ b/stdlib/grouping.c @@ -64,9 +64,17 @@ __correctly_grouped_prefixmb (const STRING_TYPE *begin, const STRING_TYPE *end, thousands_len = strlen (thousands); #endif +#ifdef USE_WIDE_CHAR while (end > begin) +#else + while (end - begin >= thousands_len) +#endif { +#ifdef USE_WIDE_CHAR const STRING_TYPE *cp = end - 1; +#else + const STRING_TYPE *cp = end - thousands_len; +#endif const char *gp = grouping; /* Check first group. */
next reply other threads:[~2022-10-12 14:15 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-12 14:15 Szabolcs Nagy [this message] 2022-10-26 15:11 Szabolcs Nagy
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=20221012141550.278373851165@sourceware.org \ --to=nsz@sourceware.org \ --cc=glibc-cvs@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: 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).