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 1thtWL-008BJy-6G for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 16:54:01 +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 1thtWJ-00D10X-Ll for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 16:53:59 +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 1thtWJ-00D10P-CO for pgsql-hackers@lists.postgresql.org; Tue, 11 Feb 2025 16:53:59 +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.96) (envelope-from ) id 1thtWG-000GxE-14 for pgsql-hackers@postgresql.org; Tue, 11 Feb 2025 16:53:59 +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 51BGrbb12940639; Tue, 11 Feb 2025 11:53:38 -0500 From: Tom Lane To: =?utf-8?q?=D0=9A=D0=BE=D1=80=D0=BE=D1=82=D0=BA=D0=BE=D0=B2_=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC?= cc: pgsql-hackers@postgresql.org Subject: Re: [PATCH] snowball: fix potential NULL dereference In-reply-to: <1d1a46-67ab1000-21-80c451@83151435> References: <1d1a46-67ab1000-21-80c451@83151435> Comments: In-reply-to =?utf-8?q?=D0=9A=D0=BE=D1=80=D0=BE=D1=82=D0=BA=D0=BE=D0=B2_=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC?= message dated "Tue, 11 Feb 2025 11:52:29 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2940637.1739292817.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 11 Feb 2025 11:53:37 -0500 Message-ID: <2940638.1739292817@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =3D?utf-8?q?=3DD0=3D9A=3DD0=3DBE=3DD1=3D80=3DD0=3DBE=3DD1=3D82=3DD0=3DBA=3D= D0=3DBE=3DD0=3DB2_=3DD0=3D9C=3DD0=3DB0=3DD0=3DBA=3DD1=3D81=3DD0=3DB8=3DD0=3D= BC?=3D writes: > I found the case of potential NULL pointer dereference. > In snowball/libstemmer/api.c if we transfer control to the SN_create_env= () function > by using the error label when there is a memory allocation error of z->p= or z->S, > we can then dereference the NULL pointer z->S in the function SN_close_e= nv(). > Added the pointer check for avoiding a potential problem. I believe you are right: OOM partway through SN_create_env would fail. However, backend/snowball is not our code so applying our own local patch is not the way to fix it. You should report this upstream; see src/backend/snowball/README. (Whenever they apply the patch, we should then re-sync...) regards, tom lane