From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 70B0D3858C83; Thu, 2 Mar 2023 11:08:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 70B0D3858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677755284; bh=TMIJJqemGAQ1zuXLEEBYIh2XoV+jNpy22z4yKJrTjD8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NuA78N4QLRmNQVDXj/nsT1oNL0CVOA+KXRnPqCZl7eOFu6zI/owWCO/yZU5Cd+Mjk /05ZEWu4bExb7y71zNZCCp5Z2L6SR5XBpz0EzgxmVLTFf0zari5hFiQk9NFE1NA4Fz ZLLJY96re4K/TVPvLlmKUDyf4XQsGvnr+hxNIdd4= From: "dmjpp at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/108976] codecvt for Unicode allows surrogate code points Date: Thu, 02 Mar 2023 11:08:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: dmjpp at hotmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108976 --- Comment #2 from Dimitrij Mijoski --- (In reply to Dimitrij Mijoski from comment #0) > Those that read from UCS-2 seem to me like they properly report the error. > Reading from UTF-16 can not have this bug by definition. From what I > checked, the functions for reading UTF-16 properly treat unpaired surroga= te > code units as error. Seems like the conversion from UCS-2 to UTF-16BE/LE is also affected. This conversions is called via codecvt_utf16::out(). See line https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dblob;f=3Dlibstdc%2B%2B-v3/src/c%2B= %2B11/codecvt.cc;h=3D02f05752de84139a7eb7c3d40946b61f4c0334cf;hb=3DHEAD#l656 it only checks for high surrogate but should also check for low.=