From patchwork Wed Jun 21 18:58:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Boeckel X-Patchwork-Id: 1798090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=benboeckel.net header.i=@benboeckel.net header.a=rsa-sha256 header.s=fm3 header.b=mdSTUhkm; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm2 header.b=A/ScTcwN; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QmXpV2GWlz20Wk for ; Thu, 22 Jun 2023 04:58:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0CE363857835 for ; Wed, 21 Jun 2023 18:58:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by sourceware.org (Postfix) with ESMTPS id CE9123858D28; Wed, 21 Jun 2023 18:58:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE9123858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=benboeckel.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=benboeckel.net Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id F1C2A5C0195; Wed, 21 Jun 2023 14:58:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 21 Jun 2023 14:58:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benboeckel.net; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to; s=fm3; t=1687373904; x=1687460304; bh=D6 EBcLMFg9sbGFBnVIKuUNHLvatgo38arlWe97Du9Wg=; b=mdSTUhkmxRqIGZVe18 Lwwy59ojz/lfYt1NGdU/oAU3vXNkxJE07TcM7PdfScDORPJ++prcssk8a0Qtvbcl XWHwguO+flRsn2ifdfTbAEdK1RFLnCoEGs61W5jssw16ElLrRZ7ei/k5woanwkon kxr8MpupAdzdmOjToPhV+Li4mfvVJa0rnJBnCtbNxuZ2tvAa3lP/umeoH5J7b9UJ cO2d+l3MQ81VQYa19QNhl5QUlSDpiS8NWqrJVpX2Q1afsI/3yUXDoOMn2VS2jHT/ QbLU6/vpCZbdI7bSlo2UyM7kAOMMqk8GRfkiNN7OkqFHD655jUUhTLFdk/38PzXQ vYhg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1687373904; x=1687460304; bh=D6EBcLMFg9sbG FBnVIKuUNHLvatgo38arlWe97Du9Wg=; b=A/ScTcwNzSeMolLiMjVCfRFG8A/or ZzBdVIlOyZPJjxvLqF+AYv992YaBEN7cRen2I/IqRQB1+Y8QboMhbYz9pwJOxbZi EfPA+lD0keu57UYnOzYjA+KJz9KCl1xa1BWViZGSGibV2wez165SSDMOU+sMQV6r txpkQHg0HDrHevpq5Cjv6AncQZey4kyUBc6bH66y0YhGGiV35eqOSJUshTa1J2Kd UHiaaq1OzpdpmCDBS2aP9savkmj68Yxob6QOI/Y2FGgi9OkIZbGhwaBT4FTkw4Dl OUGOwFe3GDfkKOqck4PwSRbXGw3NNzdpjl95uv0Enxx9RYPB2NdP9HaOg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeefledgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomhepuegvnhcuueho vggtkhgvlhcuoehmvgessggvnhgsohgvtghkvghlrdhnvghtqeenucggtffrrghtthgvrh hnpeffleetleelleefjeefveetgefffeehgefhjeeffedtteehuedujeffjeekhefgfeen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmvgessg gvnhgsohgvtghkvghlrdhnvght X-ME-Proxy: Feedback-ID: iffc1478b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 21 Jun 2023 14:58:24 -0400 (EDT) From: Ben Boeckel To: gcc-patches@gcc.gnu.org Cc: Ben Boeckel , jason@redhat.com, gcc@gcc.gnu.org, brad.king@kitware.com, Damien Guibouret Subject: [PATCH 1/1] libcpp: allow UCS_LIMIT codepoints in UTF-8 strings Date: Wed, 21 Jun 2023 14:58:20 -0400 Message-Id: <20230621185820.1766291-1-ben.boeckel@kitware.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" libcpp/ * charset.cc: Allow `UCS_LIMIT` in UTF-8 strings. Reported-by: Damien Guibouret Fixes: c1dbaa6656a (libcpp: reject codepoints above 0x10FFFF, 2023-06-06) Signed-off-by: Ben Boeckel --- libcpp/charset.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpp/charset.cc b/libcpp/charset.cc index d4f573e365f..54ebab2b8a4 100644 --- a/libcpp/charset.cc +++ b/libcpp/charset.cc @@ -1891,7 +1891,7 @@ cpp_valid_utf8_p (const char *buffer, size_t num_bytes) invalid because they cannot be represented in UTF-16. Reject such values.*/ - if (cp >= UCS_LIMIT) + if (cp > UCS_LIMIT) return false; } /* No problems encountered. */