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 1qd3Bk-0020vs-M8 for pgsql-bugs@arkaria.postgresql.org; Mon, 04 Sep 2023 06:35:57 +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 1qd3Bj-008w6x-6s for pgsql-bugs@arkaria.postgresql.org; Mon, 04 Sep 2023 06:35:54 +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 1qd3Bi-008w6m-Ez for pgsql-bugs@lists.postgresql.org; Mon, 04 Sep 2023 06:35:54 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qd3Be-002dMC-Tw for pgsql-bugs@lists.postgresql.org; Mon, 04 Sep 2023 06:35:52 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id B52EB32005D8; Mon, 4 Sep 2023 02:35:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 04 Sep 2023 02:35:49 -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:sender :subject:subject:to:to; s=fm1; t=1693809348; x=1693895748; bh=oo WMKciINkFB4DJp7Gz9gL3wuxagYy7yGfNEyLs7/0g=; b=nGLBqFrkei2StElya/ PmKhbVR0Hwbv9sEv2JjaD+oTlICLUIkNCOcc28dIYNkKuvwvHtUIiQ30w35OInBR tNhJhXKPi9F2sgvpPW27cV5nIjLOmvi4IV1CUE13KC9vuAmoVWDf45xgtQdpfLxo 0UYAJxqc9jJPiP0dBh0+e+MYGtnhYNHpOSC+UjmLc9NDlzc4PQp9MYcXpzbRl42K un6FBbwl9l82VRyyozqy3+HB1GhuLq8W5moOVmFG6Bpffzz69J05ItPHI3RVirL3 FmEci2pffHjmLZhds40gvPfMhRvx1+ATNOGdqpRKNC9sLLiZIXZ6Zd+bDK2L+qTg 8p6Q== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1693809348; x=1693895748; bh=ooWMKciINkFB4 DJp7Gz9gL3wuxagYy7yGfNEyLs7/0g=; b=ksCve+6ts3pXSh5wLW93cImemqRhx D2k4Tz8vC+Oiyj5uIrdMYEemXYnnXa0Sk29NkDR55TXj1wtIa9gvrPx9pCqsw6Hy EHtQB8iIjx1kGzWvRDFb09mKKcD8YzvAdA1x3zgTBQuaV5P8y1Dv4ZagEpD9bcLD Kc1bQBr1oDO3r7evGKS5QSK1qXUayscOJcwK0+n3tUrQuKJoZkbocWG3TqVqLogf caYTmLDondpG/3mPS3UZjUMXT9aqecJh0hIhbEYq1mP0mzclUfU4O8QViB4pdXce +Dbj3TrXa2veyTSwyK7tKEjxble7IRZlabaQwVq60b3OnjXTKoxwwNRvw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudegjedguddufecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhepff fhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgr qhhuihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtth gvrhhnpeetleeifedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedv jeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmih gthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Sep 2023 02:35:46 -0400 (EDT) Date: Mon, 4 Sep 2023 15:35:41 +0900 From: Michael Paquier To: Alexander Lakhin Cc: Tom Lane , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17950: Incorrect memory access in gtsvector_picksplit() Message-ID: References: <17950-6c80a8d2b94ec695@postgresql.org> <665394.1691937343@sss.pgh.pa.us> <09fec706-0691-a131-5c6c-3e64ecc134fc@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1SlbNh5YvMk9I8ex" Content-Disposition: inline In-Reply-To: <09fec706-0691-a131-5c6c-3e64ecc134fc@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --1SlbNh5YvMk9I8ex Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 13, 2023 at 09:00:01PM +0300, Alexander Lakhin wrote: > I've tried to make that addition as valuable as possible in the context of > this issue, but as it is too expensive (to be honest, I was bolstered by > the gin test duration (~10 secs too)), then let's leave it aside. I have applied 0001 down to 11 to get the basic fix in place, but the regression tests are really too expensive compared to the value they bring.=20 Regarding the changes in gtsvectorout(), the output produced is indeed confusing when ISALLTRUE is set. - int siglen =3D GETSIGLEN(key); - int cnttrue =3D (ISALLTRUE(key)) ? SIGLENBIT(siglen) : = sizebitvec(GETSIGN(key), siglen); + if (ISALLTRUE(key)) + sprintf(outbuf, "all true bits"); + else + { + int siglen =3D GETSIGLEN(key); + int cnttrue =3D (ISALLTRUE(key)) ? SIGLENBIT(siglen= ) : sizebitvec(GETSIGN(key), siglen); =20 - sprintf(outbuf, SINGOUTSTR, cnttrue, (int) SIGLENBIT(siglen) - cnt= true); + sprintf(outbuf, SINGOUTSTR, cnttrue, (int) SIGLENBIT(siglen) -= cnttrue); + } In the false branch of ISALLTRUE(key), why isn't cnttrue always calculated with sizebitvec()? It's also not something I would backpatch. That's confusing, for sure, but there is also the argument of keeping a consistent output in the stable branches. -- Michael --1SlbNh5YvMk9I8ex Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmT1er0ACgkQnvQgOdby QH3qdg/+I/40Hx72FzqiK/PvZZh3ZdNB3lNeOeYmJZSVokHJIbBz2KMqLaiPIV37 rl2k6K9VDiHj4w+vMSI4N12dh1vo8DRZSvGpF1HiEwFCc2hY6m9+AZi2hzHIxxqH +hnRfika2NWZ6idJorXzj0MzNVpJQZBbp0Rtq4HUvFM2gSo+bG1KVhD+SCXCxfWz RgsDw1cGAx+/yxOXSlRZh6lAI5gDF6UR2XfPmY9IS2LsDi3yRzYe4OiMNHt5T4x7 dh9CGqvz57dBtt1/+URDNBjNh2U7xgXp6klNOldS8OCsEtHptN/6zo3AUFTDTiSr UG/vGzuL6NXKDg0Ms+Qjp8Jo2e0dMpI22UpKX6/CGnHRxJEFBDeYlpK5kNVrRIok X5Ur9PQKSuiYqXl94DPZe/bjZHSVhYNJUFMWWeI1jvQauwqRC5KSqLi42RA8a8ad X0qNhtfnGw1at/ZDFaBCYVesDrdAMLwl0ROvc/u6puegyQS61hvSjfkprkTICiLX oQcWVCUn1gTbfFkL7J+rSSjsSWK36/a/Cs7sbWBZJ1Io1faj2N5N+PE0/SGFk5bU 4cF6U/wmiV/E499dM4DRyzLc89i1M0kCCEYH3h+DajBf3q47GSH9e8H4/GGAD/EK L0urdS4HRs/1GoRKbgRTYAh3iK5E9gMVU/sLDKi2zEsKzmIEkb4= =iz4q -----END PGP SIGNATURE----- --1SlbNh5YvMk9I8ex--