Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iR0Je-0002MN-16 for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Nov 2019 20:48:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iR0Jb-0007hP-JC for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Nov 2019 20:48:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iR0Jb-0007gz-7Q for pgsql-hackers@lists.postgresql.org; Sat, 02 Nov 2019 20:48:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iR0JY-00050n-Ri for pgsql-hackers@postgresql.org; Sat, 02 Nov 2019 20:48:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xA2Km0Yx029258; Sat, 2 Nov 2019 16:48:00 -0400 From: Tom Lane To: Arthur Zakirov cc: Tomas Vondra , pgsql-hackers@postgresql.org, Teodor Sigaev Subject: Re: CREATE TEXT SEARCH DICTIONARY segfaulting on 9.6+ In-reply-to: <3d98671e-f2ea-40ec-d0e7-d5c5cbb16ca3@gmail.com> References: <20191013012610.2p2fp3zzpoav7jzf@development> <3d98671e-f2ea-40ec-d0e7-d5c5cbb16ca3@gmail.com> Comments: In-reply-to Arthur Zakirov message dated "Mon, 28 Oct 2019 11:59:01 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29256.1572727680.1@sss.pgh.pa.us> Date: Sat, 02 Nov 2019 16:48:00 -0400 Message-ID: <29257.1572727680@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Arthur Zakirov writes: > On 2019/10/13 10:26, Tomas Vondra wrote: >> So I think we need some sort of cross-check here. We certainly need to >> make NISortDictionary() check the affix value is within AffixData >> bounds, and error out when the index is non-sensical (maybe negative >> and/or exceeding nAffixData). > I agree, I attached the patch which do this. I also added couple > asserts, tests and fixed condition in getAffixFlagSet(): > - if (curaffix > 0 && curaffix <= Conf->nAffixData) > + if (curaffix > 0 && curaffix < Conf->nAffixData) Looks reasonable to me, and we need to get something done before the upcoming releases, so I pushed this. Perhaps there's more that could be done later. regards, tom lane