Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2M6n-002M2Q-B6 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 May 2024 02:23:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s2M6k-00FBXH-Cs for pgsql-hackers@arkaria.postgresql.org; Thu, 02 May 2024 02:23:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2M6h-00FBX9-UP for pgsql-hackers@lists.postgresql.org; Thu, 02 May 2024 02:23:38 +0000 Received: from fout1-smtp.messagingengine.com ([103.168.172.144]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2M6b-00111t-JV for pgsql-hackers@postgresql.org; Thu, 02 May 2024 02:23:35 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id 745B3138013A; Wed, 1 May 2024 22:23:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 01 May 2024 22:23:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1714616607; x=1714703007; bh=+zrvX4Txhz XcUS3B4Ot97xf6CceQwoXrlwH0vC8Ggvo=; b=HWZTbWfcWq5yqGJqbOUWanxUCD U8XkJljbk5o3cb61+EqSGFUs6bEMPhTyYRy5XwkNYD9QWSPS33J52EgdRlV4py2M PjtDJ4qxAHNIPo8MlEY2nkm87Bgw2rZ8GrDb+fTMm7szYKhOWeLXhz/LHOjy9bWN 08oFVMchHH/CKPQZNE9usJSJ0cmPkOWhBKQVz4JzTytHBaqb0TEAZrdWhmkewSv5 o+UxTOe3OHhAKy6QLkuBjfk3G84LaQumCZk5L1/V1pBojchrbsOiReoee1azIvDV So9gwrQ4ramZbkYBlYratM8Ov8ao81IS42lzLzAU6SjENaw12qbP0cDKpedQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1714616607; x=1714703007; bh=+zrvX4TxhzXcUS3B4Ot97xf6CceQ woXrlwH0vC8Ggvo=; b=TLctOp6RVdl6KVoPWNfMWW6Bed7o+XYOvA/M2aWxqHSQ Z5f93mBmR2iacKOqkYIziOZ6awRKOxjyE53UjcvT8voNZhlawWSQSe7CRQXWh8VF 6joNBIZFDptdfYHfjGdzjEUOaXJDRV8Zh2msgcGjb8UlLwlhmdptdhCJsr58mQV4 rI7Lqm8LEf93/INCmU8n/u6ZkJkZmUFAxkxFvCfkGV4Pz8hmjTwafGw/m9VO1IR+ z/EzZH3nqE0hAY8OWJ+CXlCmv9FdX/k5iSVfLLsE2nlmOHieH3drRFfI7yqrzpHP DLOhndZQzMtREBtqE4zyE+H8oFARHa9e3q6+w2SQnw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddujedgheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tdejnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepveetjefgjeevgedukeehieeu ieeuieevueeiudegheevuefggfduueelgeelieetnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 May 2024 22:23:25 -0400 (EDT) Date: Thu, 2 May 2024 11:23:13 +0900 From: Michael Paquier To: Jacob Champion Cc: PostgreSQL Hackers , Andrew Dunstan Subject: Re: [PATCH] json_lex_string: don't overread on bad UTF8 Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BZFW0y9TJIbPCblJ" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --BZFW0y9TJIbPCblJ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 01, 2024 at 04:22:24PM -0700, Jacob Champion wrote: > On Tue, Apr 30, 2024 at 11:09=E2=80=AFPM Michael Paquier wrote: >> Not sure to like much the fact that this advances token_terminator >> first. Wouldn't it be better to calculate pg_encoding_mblen() first, >> then save token_terminator? I feel a bit uneasy about saving a value >> in token_terminator past the end of the string. That a nit in this >> context, still.. >=20 > v2 tries it that way; see what you think. Is the concern that someone > might add code later that escapes that macro early? Yeah, I am not sure if that's something that would really happen, but that looks like a good practice to keep anyway to keep a clean stack at any time. >> Ah, that makes sense. That looks OK here. A comment around the test >> would be adapted to document that, I guess. >=20 > Done. That seems OK at quick glance. I don't have much room to do something about this patch this week as an effect of Golden Week and the buildfarm effect, but I should be able to get to it next week once the next round of minor releases is tagged. About the fact that we may finish by printing unfinished UTF-8 sequences, I'd be curious to hear your thoughts. Now, the information provided about the partial byte sequences can be also useful for debugging on top of having the error code, no? -- Michael --BZFW0y9TJIbPCblJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmYy+REACgkQnvQgOdby QH0mTg//VzDPdPY3q6fwE3vZx03AmPVZZRs8+z/vmnl8h/fOBJUsR5ZvIXTaiFAo eC/i/r90FI5fvy7128geaqdjhYfjqTas7X2lNlvgyEusOKR7oXljXP+Q2eAhBJek 4GdR7jfqQYC9nD2RyeQJ/mVLln+ziYAKCXNFtAMWfj0XTZ8c767g+RKbmTpn56+C cpMVTa8yYWudp30dOQ4AsLKseTWI7e4ekBMJ6/oLGTHDl1XU3fv8wQKcpN7DDdKs AcClgESSLx0VooGDVjQSJtxLVgaywkHe4Wnjf0Lr5NKsx/1IPOhR3+LkEtv8mT0T cBga5dJzwXdLsY9bLYrKCeVOcvbBJ99IhuYBYt5gvc6rn0YZUoZ4jalgTkH5VmF8 hFedVZO9r4I1GGBulGJhJfussiILm61JHWz+Xlczchpa3QFwJP138/gQBpMic70Q L34K40l0L40hpwNy2nT8ooLipH0yXghxUn2scn0q9F2nALwd3aX3BDITWBppbQ2F ++7YW6jzM7Yh8NYk0OXh72aMIZDEOP17g+A6VFyUYtdyqHruXdREea/QEc3KxjsE 8tXyZcNADzBiKP4J+N6dmy4I4ck00T3OPdB8Yh5+OmT/qRqjnzEbjvx+P0Zc4iFR XsN0tFv9ff+YJckrdnOFOiMYzBqwWJbQ4qbC6DbKQlIJE9bmWVo= =7WFp -----END PGP SIGNATURE----- --BZFW0y9TJIbPCblJ--