From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5728 Path: news.gmane.org!not-for-mail From: Alon Zakai Newsgroups: gmane.linux.lib.musl.general Subject: Bug report on iswalpha Date: Tue, 5 Aug 2014 13:35:27 -0700 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7ba97cc4b8c7b004ffe7cb52 X-Trace: ger.gmane.org 1407270947 24926 80.91.229.3 (5 Aug 2014 20:35:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Aug 2014 20:35:47 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5733-gllmg-musl=m.gmane.org@lists.openwall.com Tue Aug 05 22:35:40 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XElSO-00050a-3L for gllmg-musl@plane.gmane.org; Tue, 05 Aug 2014 22:35:40 +0200 Original-Received: (qmail 11568 invoked by uid 550); 5 Aug 2014 20:35:39 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11560 invoked from network); 5 Aug 2014 20:35:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=bvUD3k7uh+7uKeOA7LrSlb9DInPd2FavCwHA2tk9HIQ=; b=PzpjXzgFn9IGASYbUtg5nplFM0x7T9A3nCkSKyroAI+S06X9Cj9I4xzPTzsnXLE132 QUY5jfIJRO79LomewoavF+bz7ukezByeCLW580IFZNdGW0+N1N2D97X7w5Qwwsvw9vmZ GBtkntmAwbzp1GFmoqxzWb0T77SALrsZonZjPIpk+UHhvZUvBymLLUPVwpc6CZSE40gr LhiIVJq8cdZXgrptwq4a2zVdZp5U+wr5jTyoiCtloF2panBSYBTTd3RYoYbNck5Tyki7 t9O1St9IvX0CSWFNhyJD3XpFS5+1wa9HFcWuQgU04p/kVYLDSnCzYcY1xNyjg0QEnWLL iM4Q== X-Received: by 10.194.59.112 with SMTP id y16mr9384470wjq.67.1407270927252; Tue, 05 Aug 2014 13:35:27 -0700 (PDT) Xref: news.gmane.org gmane.linux.lib.musl.general:5728 Archived-At: --047d7ba97cc4b8c7b004ffe7cb52 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I think we have encountered a bug in iswalpha, as shown by the following program: =3D=3D=3D=3D #include #include #include int main(const int argc, const char * const * const argv) { const char * const locale =3D (argc > 1 ? argv[1] : "C"); const char * const actual =3D setlocale(LC_ALL, locale); if(actual =3D=3D NULL) { printf("%s locale not supported; skipped locale-dependent code\n", locale); return 0; } printf("locale set to %s: %s\n", locale, actual); const int result =3D iswalpha(0xf4); // =C3=B4 printf("iswalpha(\"\xc3\xb4\") =3D %d\n", result); return 0; } =3D=3D=3D=3D It returns 1 in the final printf, saying that that char is an walpha char, when I believe it is not. For comparison, glibc reports 0. Tested on musl 1.0.3 (used in emscripten) and musl trunk on git, same result. - Alon --047d7ba97cc4b8c7b004ffe7cb52 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I think we have encountered a bug in iswalpha, as sho= wn by the following program:

=3D=3D=3D=3D
#include <locale.h&g= t;
#include <stdio.h>
#include <wctype.h>

int
m= ain(const int argc, const char * const * const argv)
{
=C2=A0 const char * const locale =3D (argc > 1 ? argv[1] : "C&= quot;);
=C2=A0 const char * const actual =3D setlocale(LC_ALL, locale);<= br>=C2=A0 if(actual =3D=3D NULL) {
=C2=A0=C2=A0=C2=A0 printf("%s lo= cale not supported; skipped locale-dependent code\n",
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 locale);
= =C2=A0=C2=A0=C2=A0 return 0;
=C2=A0 }
=C2=A0 printf("locale set = to %s: %s\n", locale, actual);

=C2=A0 const int result =3D iswa= lpha(0xf4); // =C3=B4
=C2=A0 printf("iswalpha(\"\xc3\xb4\"= ;) =3D %d\n", result);
=C2=A0 return 0;
}
=3D=3D=3D=3D

It returns 1 in the= final printf, saying that that char is an walpha char, when I believe it i= s not. For comparison, glibc reports 0.

Tested on musl 1.= 0.3 (used in emscripten) and musl trunk on git, same result.

- Alon

--047d7ba97cc4b8c7b004ffe7cb52--