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 1t1fuL-00HNR2-2I for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Oct 2024 05:52:17 +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 1t1fuI-00GIYO-MS for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Oct 2024 05:52:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t1fuH-00GIXZ-Be for pgsql-bugs@lists.postgresql.org; Fri, 18 Oct 2024 05:52:14 +0000 Received: from fhigh-a7-smtp.messagingengine.com ([103.168.172.158]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t1fuE-001f7L-BC for pgsql-bugs@lists.postgresql.org; Fri, 18 Oct 2024 05:52:13 +0000 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id CC4381140170; Fri, 18 Oct 2024 01:52:07 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Fri, 18 Oct 2024 01:52:07 -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=fm2; t=1729230727; x=1729317127; bh=lXMC/SUzD3 MN/utvMgUNOmVX7XdAIQ+yw22iKB4v+Js=; b=A9Le/c06REotaCZkcN+98kxgqi jTEbEs8CSHjIdR5tRDskTNPB1scFf0GCmpvD/Y32jsYo1L/U6ql9245X08C+qGdZ HRyZK8ni49bDZd2ctR28OxUllYonw43di6wGdRQfsYxjDMMdrbGxalp+X4V9jeFo 0Xe7luAeUJxzk/K8vKErEVkcZNCWiHDFsY+d6LHeY2YlS3vd4hiTVwWNAH4fYVBm +73aghW5kSvEg/BOXXk185rk17TS0CYUdJf46n6ofbw3cncY/4bsr7/4P9MVCbw6 MlI/hEERkKievPRdv0I6EsLJEHw5VZnaOoXBeD62RgF17eyBuPzhyd6gnkiQ== 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= fm2; t=1729230727; x=1729317127; bh=lXMC/SUzD3MN/utvMgUNOmVX7XdA IQ+yw22iKB4v+Js=; b=B9rDlR1rm3zJc51W4fbPm7uxMIGV5FA0SJKo4gfFo+nR 3XlIGaTfnhYsDKBgRdLxZbMgkF0KBDgB2X/jsYetBxElO2DMtuI+rgHNc5jNXeof Xsg1+MoVbeQU0X0f9lwidDlcdQ6LpQ42pDSrCu1b0obCz0IlqFcvVYWh6um61sEO f6NaHe5N2IXzzb/boXol/gkRgiCt1jTvoi2SNfwWxxYV/VPRRBBVgzbbJddjEsks DYpYszKOnxEu6gxhM7jl4S+M1bXf5BKWRKnxpfDnMHWhXyDANTp5tISgjBw0A+4z K9Gds3em85WPIEcRcehdIMUBxa+QgVc4DDjlzIwwQQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehvddguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenfghrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffk fhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrh cuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeet leeifedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedvjeenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghl sehprghquhhivghrrdighiiipdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopegsrhhutggvsehmohhmjhhirghnrdhushdprhgtphhtthhopehp rdhnvghkrhgrshhovhesfhhosghoshdqnhhtrdhruhdprhgtphhtthhopehpghhsqhhlqd gsuhhgsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 18 Oct 2024 01:52:05 -0400 (EDT) Date: Fri, 18 Oct 2024 14:51:32 +0900 From: Michael Paquier To: Bruce Momjian Cc: p.nekrasov@fobos-nt.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18614: [ECPG] out of bound in DecodeDateTime Message-ID: References: <18614-6bbe00117352309e@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="wP200Tdrea4G8r4p" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --wP200Tdrea4G8r4p Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Oct 17, 2024 at 01:29:03PM -0400, Bruce Momjian wrote: > Added in the attached patch. Is the output correct? Well, no. The result in the regression test output you are producing is a consequence that PGTYPEStimestamp_from_asc() returns PGTYPES_TS_BAD_TIMESTAMP as errno with 0 as result. Hence, after applying an offset this prints a timestamp with year 2000. What this should report in the regression test output is the information about the error happening, so the output that makes no sense because the timestamp could not be understood. > + ts1 = PGTYPEStimestamp_from_asc("AM95000062", NULL); > + text = PGTYPEStimestamp_to_asc(ts1); > + printf("timestamp_to_asc4: %s\n", text); > + PGTYPESchar_free(text); > + > /* abc-03:10:35-def-02/11/94-gh */ > /* 12345678901234567890123456789 */ It is not entirely the fault of this patch, because the same error is done a couple of lines above when using an incorrect hour number with timestamp_to_asc3. The correct thing to do would be in the lines of what num_test2.pgc does with its check_errno(), I think where we'd check for the errno returned by PGTYPEStimestamp_from_asc() and printf() its information in the output of the test. And we should do that for both the old timestamp_to_asc3 and your new timestamp_to_asc4 if we want to be completely correct. -- Michael --wP200Tdrea4G8r4p Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmcR92QACgkQnvQgOdby QH2rihAApLmdF2Eo4VoWZIJCjoecvMO5ZGGi9yk/y/tzNc+gs5zJsrsD4G3ECtok 9wzR+IMOaSDZadTVEEJtB7FRIuDJX9ElitPru3Yb+YkaHKa/PwS/rVhlVc5f9150 +zJ06j/RkcIw1pwSKhftrIGUZ2JO9589e+cgpg667fDDmLcho57rts++q0cml+0m rXTefGaeXZgP5rmqTmW9/uOZ27kBA6W1WiO9C4quZGCHsTvGhEnWYyoTuSOZjb14 qTjaBUijr+kRqIkAaAf06t1TsN9oNUSMZ3s79/8PCenZZx3TNZB5KGTa0hph6Gk1 97/fThH+6NocTwIx8nRtjtIrfioGDT2V7/MI0ewkXKVEnyBgusUYfE1g/NmJD1Qg aX3GnNFnL1KD/h4dUgrTKe/PxUXta7vSYbZUYMi1SPZds461Y1HnpG+eaJgtrFJs ICXiHx3fgO/e13hQTi6af4k4d/DIiJ/AYtKi56Z8DzHDzOBLfWnjBQuncACQowIK DiU8S3dqI+9ND513fqQzOfGmsAJ1aJfu0LDUvLKqfqDWakeVq43ALNiQsZd5aGFi r21KVT0aCG7qWjAq1KjAhIaV+lLwxhEnrw4MllL+hsz65gknpcofZ6CF7wEY03vA 6HAgClJTOH9esjlvOBVkWmNNalkrBGz+j+afwHw96Pf6qjPrbZA= =0WaI -----END PGP SIGNATURE----- --wP200Tdrea4G8r4p--