|
|
Message-ID: <2cae544b.2a5ff.1a1f247eaa7.Coremail.zhaotq@pku.edu.cn>
Date: Thu, 19 Nov 2026 13:29:21 +0800 (GMT+08:00)
From: zhaotq@....edu.cn
To: musl@...ts.openwall.com
Subject: musl libc 1.2.5: titlecase characters violate POSIX lower/upper
mutual exclusion
Hello,
We found a POSIX character-classification defect in musl 1.2.5: some
characters are classified as both lower and upper. The probe selects C.UTF-8
before testing so that the non-ASCII wide characters are valid arguments
under POSIX.
musl implements:
int iswlower(wint_t wc) { return towupper(wc) != wc; }
int iswupper(wint_t wc) { return towlower(wc) != wc; }
Some Unicode titlecase characters, including U+01C5 and U+01C8, have case
mappings in both directions. Consequently musl returns nonzero from both
functions for those code points.
POSIX.1-2024 XBD 7.3.1 marks lower and upper as mutually exclusive in its
"Valid Character Class Combinations" table. XSH iswlower() and iswupper()
require nonzero results only for members of the respective class. Returning
nonzero from both functions for U+01C5 and U+01C8 therefore means at least
one classification is incorrect.
The probe also tests U+1F88, which musl classifies only as upper; that value
does not demonstrate the violation. This finding does not require all
titlecase characters to return zero from both functions.
The reduced test is:
#include <locale.h>
#include <stdio.h>
#include <wctype.h>
int main(void)
{
wint_t wc = 0x01C5;
if (!setlocale(LC_ALL, "C.UTF-8"))
return 2;
printf("lower=%d upper=%d ctype-lower=%d ctype-upper=%d\n",
!!iswlower(wc),
!!iswupper(wc),
!!iswctype(wc, wctype("lower")),
!!iswctype(wc, wctype("upper")));
return 0;
}
Reproduction:
tar xzf 03-titlecase-posix-mutex.tar.gz
./prepare.sh
cd musl-1.2.5
./poc/ctype/run-caseclass.sh
Expected marker:
CTYPE_TITLECASE_POSIX_MUTEX_BUG_REPRODUCED=1.
`prepare.sh` downloads the official musl 1.2.5 source from
https://musl.libc.org/releases/musl-1.2.5.tar.gz and verifies this SHA-256:
a9a118bbe84d8764da0ea0d28b3ab3fae8477fc7e4085d90102b8596fc7c75e4.
Attached are the PoC archive and README.md, which documents the
environment requirements, reproduction commands, and observed results.
Archive SHA-256:
58ea0181c8b8730abb9e022ab03cf8f1fdeae2e8cb29a925b61dd3cc77417a84
Thanks,
Tianqi
Download attachment "03-titlecase-posix-mutex.tar.gz" of type "application/x-gzip" (2874 bytes)
Download attachment "README.md" of type "application/octet-stream" (1933 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.