Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lURjf-00053q-2a for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Apr 2021 10:18:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lURje-0005Z9-0N for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Apr 2021 10:18:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lURjc-0005SZ-IH for pgsql-bugs@lists.postgresql.org; Thu, 08 Apr 2021 10:18:01 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lURjZ-0003cT-53 for pgsql-bugs@lists.postgresql.org; Thu, 08 Apr 2021 10:17:59 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id F19465C00A8; Thu, 8 Apr 2021 06:17:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 08 Apr 2021 06:17:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=Q40+Lga6BjPMTG8/EAhJ1+ys5cT wpbEqBxC0eU36pEg=; b=hKCAXGZHYSMYqVN4xqB4v2fktl83+DFZxj2/+ZlXepU muemo1RFT1l6z2vfesLeo38Jw3k5QwU4sQWLLiyhmjhpnp5hA+TrJrllC6jM2n3s aDitoRBpE/z0kyqXgUTFq2spy31OCTTmZQFJ106G2gYugZnphx0dwOUxRT6AryYF 6CojrDkpVHYQpaezBySxSVqakDIWLVEOT3yIw+tlac1ZtlzT/DOn3wXTGjcVQSHz g+mkhui5PaDJDx8bkAUi5oXJ/HqgXA07TVq0obaKouUH7D9HqS3aCGO2N7VYvpXv 0yjEGi9jh+U4TqBEhNtxaNOYH/KivHLUrRl7GqzecmQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Q40+Lg a6BjPMTG8/EAhJ1+ys5cTwpbEqBxC0eU36pEg=; b=bVU97swzyN+yUM2REliHvS ifGCmr1/BLCLQbGtjuUFcf6mQr6heWgoQYSw5fQN6GGGdr+f3RWHWZcfr4MugpAd iyhwTlxuSSPQ6PAGiUZ0tKc0tVfrXTSe6Y8m/vxgYYontjEabr0hakta785WNINz GetxBmJ0uKqg4s1qK+utm6mOr+mx/qn2rQdRGIunK6/bk4bpxizsHB0lKYt4D44n t/8f/5vglTcJxGlUImeTyGBjbDlmnWot/dmIuJvUde+z7oQ5wPlpEmtjSExkT3md 7J0SubeSrodZ+BBc+gEqWOELGSwUxuChAr9UMI66jYMAMgjFb6OQQujBV8qeQvPg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudejledgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpeffhf fvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrh hnpedvgeduuefhtdeuleettdevjeehheeiveeuieegleetgeeljeelieeuieehgeevhfen ucfkphepudduuddruddtvddrudektddrudekheenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 5DFC224005C; Thu, 8 Apr 2021 06:17:53 -0400 (EDT) Date: Thu, 8 Apr 2021 19:17:50 +0900 From: Michael Paquier To: Julien Rouhaud Cc: t.larionov@postgrespro.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16953: OOB access while converting "interval" to char Message-ID: References: <16953-f255a18f8c51f1d5@postgresql.org> <20210407120856.3rjxxnnzzxn74vyv@nol> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="c23yg2JyhUpSY16/" Content-Disposition: inline In-Reply-To: <20210407120856.3rjxxnnzzxn74vyv@nol> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --c23yg2JyhUpSY16/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Apr 07, 2021 at 08:08:56PM +0800, Julien Rouhaud wrote: > PFA a naive patch to fix this problem with some regression tests. I'm assuming > that -1 month should be january and not december. I had a quick look at the > rest of formatting.c and didn't spot any similar problem, but another pair of > eyes wouldn't hurt. Assuming an absolute number is not really intuitive when it comes to a negative number here, while counting backward feels more natural, so I would vote for making -1 be December, -2 November, etc. Let's also make the tests more extended. I would suggest a single query with generate_series() from say -12 to 12, that checks the output of both RM and rm for the full range of values supported by tm_mon. -- Michael --c23yg2JyhUpSY16/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmBu2E4ACgkQnvQgOdby QH25AA/9FgFydo9isYJnQbumxhS25gLNrKwXp417x1nzKE9G3EmhWWgPpXUxdzoM Nk/4KCqc5V2IEqTYrU8CDM06GPnogyB3CIW87PUXLcRkC8SDmZ/H0IzBCZJdXxgA ZA5CBEElfn0Fkvtk9tl1V86RQXluSxKIkq1vhOEpp20CXp1MKJoVpUhey3gfxA/8 MOtmwnh4d6qa50QWi6nq1t3xsXjnKj4eFuIyT1E9KNz7/wWXS1B8VPm51rFpI7RU iXni2uHB/DszWYrkbwl3fhSjsWBg0hY+E1UXUJHDYOcu7zI3H/N0acZwrQsL8LyK H2s/ZjHm/FcPnSiQxQif71cxxkX/HPOpjdzoTaN3d5lZthos+QNCACj2KRcbExA1 00CFfEYmfT17bd/yJXQr8wqJs+IYFInmuNHqnT+AD8FrNsvJJFEI9Gp7o7CLfI75 XoAXbAp75vA+rKzSk6xWJI1rgEdaNSLxFTJ6UJVZpgDbzm8LV2BVPc3EWTRaSuzN VaRHnfydszqKH6dLFRt2Sm5N96Lhr2J3FvjjEx3QAwTRqHxqSD/YTSpcFQPxpWTg zCJCI9QpnSanVkM3NC0JwuYBI/cmYYLgBSzQPVj/VuJLRXy/ZrUNaLw1Q25OBBZZ 1SS4Dir5SAFvel7PcPpi97fxmvhxBFcNTpBkwBYsiX/gvTrSOJI= =GUTE -----END PGP SIGNATURE----- --c23yg2JyhUpSY16/--