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 1pgUQC-0000iA-D8 for pgsql-bugs@arkaria.postgresql.org; Sun, 26 Mar 2023 17:44:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pgUQB-0003yj-Ad for pgsql-bugs@arkaria.postgresql.org; Sun, 26 Mar 2023 17:44:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pgUQB-0003yZ-22 for pgsql-bugs@lists.postgresql.org; Sun, 26 Mar 2023 17:44:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pgUQ8-0000Kq-F1 for pgsql-bugs@lists.postgresql.org; Sun, 26 Mar 2023 17:44:46 +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 32QHifA43008684; Sun, 26 Mar 2023 13:44:41 -0400 From: Tom Lane To: Alexander Lakhin cc: Richard Guo , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17858: ExecEvalArrayExpr() leaves uninitialised memory for multidim array with nulls In-reply-to: <87461d66-e96b-24f8-3e66-1daf937fff98@gmail.com> References: <17858-8fd287fd3663d051@postgresql.org> <4240d86f-7e9f-388b-fd96-f8944860c0f5@gmail.com> <1216375.1679408668@sss.pgh.pa.us> <87461d66-e96b-24f8-3e66-1daf937fff98@gmail.com> Comments: In-reply-to Alexander Lakhin message dated "Sun, 26 Mar 2023 07:00:00 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3008682.1679852681.1@sss.pgh.pa.us> Date: Sun, 26 Mar 2023 13:44:41 -0400 Message-ID: <3008683.1679852681@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alexander Lakhin writes: > So maybe the fix for the bug can be seen as a supplement for 18c0b4ecc. Yeah, I agree. Given that precedent, there's little excuse for ExecEvalArrayExpr not to use palloc0; the fact that it doesn't already was just an oversight in 18c0b4ecc. I realized that there's a completely separate way in which ExecEvalArrayExpr is a few bricks shy of a load: it fails to check for overflow of the output array size. Pushed the discussed changes along with a fix for that. regards, tom lane