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 1rMZ7P-005Eqb-4Y for pgsql-bugs@arkaria.postgresql.org; Sun, 07 Jan 2024 19:47:35 +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 1rMZ7O-00009E-B7 for pgsql-bugs@arkaria.postgresql.org; Sun, 07 Jan 2024 19:47:34 +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 1rMZ7O-000096-2y for pgsql-bugs@lists.postgresql.org; Sun, 07 Jan 2024 19:47:34 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rMZ7L-000MKM-Sd for pgsql-bugs@lists.postgresql.org; Sun, 07 Jan 2024 19:47:33 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 407JlTj11637354; Sun, 7 Jan 2024 14:47:29 -0500 From: Tom Lane To: Zu-Ming Jiang cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18276: Heap-buffer-overflow triggered in src/backend/utils/adt/datum.c:163 In-reply-to: <25caa537-1add-4561-8ef9-806c46ac98ce@inf.ethz.ch> References: <18276-13b98d6ec97ed5b8@postgresql.org> <1633850.1704655019@sss.pgh.pa.us> <25caa537-1add-4561-8ef9-806c46ac98ce@inf.ethz.ch> Comments: In-reply-to Zu-Ming Jiang message dated "Sun, 07 Jan 2024 20:28:28 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1637352.1704656849.1@sss.pgh.pa.us> Date: Sun, 07 Jan 2024 14:47:29 -0500 Message-ID: <1637353.1704656849@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Zu-Ming Jiang writes: > But I am bit wondering whether it is a bug. I think PostgreSQL should > not directly crash because of a incorrect datatype. Maybe PostgreSQL can > return an error? It's not reasonable to expect the system to figure out the behavior of C functions (see: halting problem). In the end this is why creating base types is a superuser-only operation: it's possible to crash the server with a wrong definition. I don't see any prospect of making that meaningfully safer. regards, tom lane