From nobody Fri Jun 30 13:58:00 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QsxjN3QH5z4lDMh for ; Fri, 30 Jun 2023 13:58:00 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QsxjN0dGwz3lfk for ; Fri, 30 Jun 2023 13:58:00 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688133480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Wd11biwoWpdFInhEqlkzlCFMHyNeXKpnpTYZ1NrfFU8=; b=IagZBHA5XFcc6dIuCKYRvXet2ScscKv5y9SnSpPveO7e59K/s/71FTsrcClpSg1q5WoK5/ Jc0fQtPbv/j3VhBj2o9Uzt+UvoXGEK/wuyowX4NJH6T/VIVKZ4NETCJM+uprp99bc2KAb0 3smYZC+e+N4xRO8nKhARtp90A5i34WDk1Kgb2aPQvDoL+IopanAIhxN+c1ZazrVev5KYBR q2Q4oInf76/1jynlFSCPIODn4mwYgCskCQcQBnuMup3PaLucFvjw7InBPB01KtkgGq7bFq h1Fk321nj058G4NZXbpKW2ghJO8p/jI/k8odh+efCKMiNI6wQqqkmh0tagFZSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688133480; a=rsa-sha256; cv=none; b=WhH57fxzN+Ve5ZR/yg5PMQ1JkdmJLLav/o7jWzmT/Zl9dWmH5XwmtjscQhsrpWlq888XO+ ijofXQwLqGRhBPQtVaPh/CGrYUtBkCbRAhcwJSRz0AIk01R79Kfl/gO4pKmn/fU7Q8beth gXJxMKWlotIjD3pE9ORbz2/NsOcq3Mr6xlBP7oFR023IqekMYWmE+6qVVKXRVNlR6Qlnsl eAMaKARuMlJIzDIiE+cPo7YiS1ZhwEWqp1R413fD3jfEpWz1gn6A1fTpvBTTrJ9FAoznBd SCm/QpDMVe5NlmbMq2Kb/9lGQzhd5VqziTAGhl3Y+xo0dbSpWxOfFhYRTmSihw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QsxjM6pjMz11rg for ; Fri, 30 Jun 2023 13:57:59 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 35UDvxdG096770 for ; Fri, 30 Jun 2023 13:57:59 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 35UDvxkA096768 for bugs@FreeBSD.org; Fri, 30 Jun 2023 13:57:59 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 272293] The mbrtoc32 and mbrtoc16 functions don't recognize the same multibyte sequences as mbrtowc Date: Fri, 30 Jun 2023 13:58:00 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: bruno@clisp.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.mimetype attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272293 Bug ID: 272293 Summary: The mbrtoc32 and mbrtoc16 functions don't recognize the same multibyte sequences as mbrtowc Product: Base System Version: 13.2-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: bruno@clisp.org Attachment #243081 text/plain mime type: Created attachment 243081 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D243081&action= =3Dedit test case foo.c It is clear from ISO C 23 (description of mbrtowc: =C2=A7 7.31.6.3.2, descr= iption of mbrtoc32: =C2=A7 7.30.1.5, description of mbrtoc16: =C2=A7 7.30.1.3) that t= he notion of valid multibyte character is independent of which of these function a progr= am uses. When a multibyte character is valid according to one of these functio= ns, it should be valid according to the two others as well. This is not the case in FreeBSD 13.2. Test case: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D foo.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #include #include #include #include #include #include int main () { if (setlocale (LC_ALL, "zh_CN.GB18030") !=3D NULL) { mbstate_t state; wchar_t wc =3D (wchar_t) 0xBADFACE; memset (&state, '\0', sizeof (mbstate_t)); if (mbrtowc (&wc, "\224\071\375\067", 4, &state) =3D=3D 4) { printf ("mbrtowc return value =3D 4\n"); { char32_t c32 =3D (char32_t) 0xBADFACE; memset (&state, '\0', sizeof (mbstate_t)); size_t ret =3D mbrtoc32 (&c32, "\224\071\375\067", 4, &state); printf ("mbrtoc32 return value =3D %d\n", (int) ret); } { char16_t c16 =3D (char16_t) 0xBADFACE; memset (&state, '\0', sizeof (mbstate_t)); size_t ret =3D mbrtoc16 (&c16, "\224\071\375\067", 4, &state); printf ("mbrtoc16 return value =3D %d\n", (int) ret); } } } } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D $ cc -Wall foo.c $ ./a.out Expected result (e.g. as seen on glibc 2.35): mbrtowc return value =3D 4 mbrtoc32 return value =3D 4 mbrtoc16 return value =3D 4 Actual result: mbrtowc return value =3D 4 mbrtoc32 return value =3D -2 mbrtoc16 return value =3D -2 I think I've seen this effect also with other encodings than GB18030. But t= he test case above is with GB18030. --=20 You are receiving this mail because: You are the assignee for the bug.=