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 1sGoAg-00HQKX-EG for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Jun 2024 23:11:27 +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 1sGoAe-00HQ7N-PE for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Jun 2024 23:11:25 +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 1sGoAd-00HQ6a-8x for pgsql-bugs@lists.postgresql.org; Mon, 10 Jun 2024 23:11:25 +0000 Received: from wfout5-smtp.messagingengine.com ([64.147.123.148]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sGoAa-000hai-RY for pgsql-bugs@lists.postgresql.org; Mon, 10 Jun 2024 23:11:22 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.west.internal (Postfix) with ESMTP id 431971C000B9; Mon, 10 Jun 2024 19:11:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 10 Jun 2024 19:11:18 -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=fm1; t=1718061077; x=1718147477; bh=6jH7VadKUy xQCBuna02F9nstDwrDSFlGENNcNblAtO4=; b=jmsp6AOQn4sggNLUR2Ae5w9qE7 QFj/AhDcw1ce1msDqnbY1IKaEBmpXgopoj4IRBDPrSikeiTG/miB+5SCdJQgk/82 KmsWgvYyDnmMjzIdSRCH7wks26s09v1FoJgMVwHRIc4pbdS1dBzYRPoPWgzrmnam LN1sC9GwM/WBLWDxFfBmUoZOhNVGEGOn7ml2MMyLz0Ak/iHu3X67FlYJZMwQFdPx WgwA8q5mbCbK/2HsjhZn5khQRRVdyG9PVdi9w6a7POVZIgutUcEfayzsVEKlbv5Q vM4ctiaCgjO901d/VsaWPJiO6niYA74T1y1EcNiVdLJI9ciDvpAfwF+dFclQ== 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= fm1; t=1718061077; x=1718147477; bh=6jH7VadKUyxQCBuna02F9nstDwrD SFlGENNcNblAtO4=; b=Qmhi5CpKEeiFTgBZkl+f9kIaUrvEVppJ/ZAssWUJSG1+ rU6+KzgLf6GQ367BJd7tNPFEXl0rq04L3STus80jzhniNdEs7ARzcJRBZLbLg5to aqcTg2A6xqf3iWcxBsKGorPHpkVn3s0gJe3WTDxw5KwuoSEDxjdGlqYeYkeE/pyQ C4hKzRWK8sUQ9ZS7asuSR2v5LHUuORJxIgvcpEeJ1xVkJQCcL5+prcSrmTCAOSHN 6mYLZpw44gt5vpALAQqS5Ile9hBxkLfz9eWuppzBTNfgwrsUKVh89ZRHtNOTJ94o NOKUFCC4c/BTSMLSzu7u0x+ElP7w3Yz3Ix2MrgR8Qg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeduuddgudekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpeffhf fvvefukfhfgggtuggjsehgtderredttddunecuhfhrohhmpefoihgthhgrvghlucfrrghq uhhivghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvg hrnhepgfehhefgudefudfgfeelgeeiffegfefhkeefffdvheefuddtheetgeelteevkeet necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitg hhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 10 Jun 2024 19:11:14 -0400 (EDT) Date: Tue, 11 Jun 2024 08:10:46 +0900 From: Michael Paquier To: Alexander Lakhin Cc: Tom Lane , a.kozhemyakin@postgrespro.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18483: Segmentation fault in tests modules Message-ID: References: <18483-30bfff42de238000@postgresql.org> <219049.1717792376@sss.pgh.pa.us> <439c9310-1d71-f2c6-b213-a9a2ea732ba9@gmail.com> <336833.1717859243@sss.pgh.pa.us> <250a21e5-d677-6b2a-2692-cd4233785e37@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="iDQVHJx50LDXrkYn" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --iDQVHJx50LDXrkYn Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 10, 2024 at 11:00:00AM +0300, Alexander Lakhin wrote: > 10.06.2024 08:50, Michael Paquier wrote: >> On Sun, Jun 09, 2024 at 03:00:00PM +0300, Alexander Lakhin wrote: >>> 2) >>> echo " >>> select test_enc_conversion('\x8bc68bcf8b', 'gb18030', 'gb18030', false); >>> " >> src/test/regress/sql/conversion.sql >>> TESTS=3D"conversion" make -s check-tests >>>=20 >>> produces (under Valgrind): >>> =3D=3D00:00:00:05.947 3320530=3D=3D Invalid read of size 1 >>> =3D=3D00:00:00:05.947 3320530=3D=3D=A0=A0=A0 at 0x6F21E5: pg_gb18030_mb= len (wchar.c:1000) >>> =3D=3D00:00:00:05.947 3320530=3D=3D=A0=A0=A0 by 0x6F2BA0: pg_encoding_m= blen (wchar.c:2072) >>> =3D=3D00:00:00:05.947 3320530=3D=3D=A0=A0=A0 by 0x6B4EAF: report_invali= d_encoding (mbutils.c:1700) >>> =3D=3D00:00:00:05.947 3320530=3D=3D=A0=A0=A0 by 0x4867D3F: test_enc_con= version (regress.c:1154) >>> =3D=3D00:00:00:05.947 3320530=3D=3D=A0=A0=A0 by 0x3B9796: ExecInterpExp= r (execExprInterp.c:764) So, valgrind is noisy here because the incomplete byte sequence \x8b passed as input of the function after a valid byte sequence causes pg_encoding_mblen() to return 2, which is 1 byte passed the end of the actual string. report_invalid_encoding() is careful to not show any data passed in its input. I am not really sure that this is worth bothering with here, TBH. As far as I know this is related to the fact that we want test_enc_conversion() to be flexible enough to accept any kind of input, working as a cheap shortcut to call these internal encoding routines. What do you think? > My Valgrind-testing procedure is: > git apply .../install-vrunner.patch # use the attached > CPPFLAGS=3D"-Og -DUSE_VALGRIND" ./configure -q && make -j8 -s Thanks. I was missing the -DUSE_VALGRIND. -- Michael --iDQVHJx50LDXrkYn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmZnh/YACgkQnvQgOdby QH1xvw/8DA5AztzQjO9O0eA/A+zivA+HeV2uGWb6Mzzj3Xwx/SAZrAX3jn+7gqFO Y0nV1ExEVxRs826blf1xsXExzdTaQanD1YFvojxW783w1ZERD54BYiHHTOFEKXIH T8RRkKBdPUgfgB6SbtAVEhva0uomTpKUGZ3trA5UoE2kVz+LZAztihp4nIlUPeG4 C1hxJELwZmHrEYjWkMRiFwbDr++RnYbWbjbRivIW/thFjOmt4QD32r4X38clEA5e UQ4a4IiygFZvyqxrE9TraBP7KjMW9mvgPNEnv9EiPL2xUTAe8Ymnfm7xlpfEAF0l XebKDGR1diMqCH9g27bcLNXhRAS5OOQu/gw7DRfoI6MIaAJotTOtXYroc9guwdn+ g87QjxVRdnahCptvcGk1cMeZjhPsEX8GlGmTWeM+vaw0sL0Jsf8iFPIErnjrCuhu TPRR58uaUAQ7A+UiR3WKtKheQp9Fv1ulyyxvbEhIig4IKYzHFce+hqdmNLfzzhO1 Mi1wrDD0Yh7faIi7nkySQTwV5YFf3vMmJi+c0QB7Ycs4zIo0mZCRovSpi+kHkPDH /qasPjgPvrvosmhirkJDRFfS76PXH/bDBSdgq7Zk7izsWwq3zISmaOeVtSCDcV2h ZRkaatRsDfcqVZmBZJX+eMlg+IwtP4yLBfCPQPZ2aUKqos+hZIE= =94d9 -----END PGP SIGNATURE----- --iDQVHJx50LDXrkYn--