Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YGvFf-0005yb-54 for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Jan 2015 19:59:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YGvFe-0000Qq-6C for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Jan 2015 19:59:42 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YGvFd-0000Qk-GU for pgsql-bugs@postgresql.org; Thu, 29 Jan 2015 19:59:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YGvFa-0002Y1-9o for pgsql-bugs@postgresql.org; Thu, 29 Jan 2015 19:59:39 +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 t0TJxUMo025920; Thu, 29 Jan 2015 14:59:31 -0500 From: Tom Lane To: Heikki Linnakangas cc: Michael Paquier , olaf.gw@googlemail.com, pgsql-bugs@postgresql.org Subject: Re: BUG #12694: crash if the number of result rows is lower than gin_fuzzy_search_limit In-reply-to: <54CA74D3.3090102@vmware.com> References: <20150128181243.2579.80775@wrigleys.postgresql.org> <54CA3EB5.3030804@vmware.com> <4773.1422545177@sss.pgh.pa.us> <54CA57B9.3070602@vmware.com> <6517.1422547480@sss.pgh.pa.us> <54CA74D3.3090102@vmware.com> Comments: In-reply-to Heikki Linnakangas message dated "Thu, 29 Jan 2015 19:58:43 +0200" Date: Thu, 29 Jan 2015 14:59:30 -0500 Message-ID: <25919.1422561570@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Heikki Linnakangas writes: > For master and 9.4, I'm thinking of applying the attached. It makes it > clear that startScan() is not used to re-start a scan with existing scan > keys, but is always called on a newly initialized scan keys. Looks reasonable to me, but should ginFreeScanKeys() null out the pointers after freeing them, to be sure we find any incorrect accesses? It might not be worth the trouble; but if you have any doubts at all about the order of operations this seems like a good safety feature. Also, in the department of nitpicks, I'd do this: { IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0); + GinScanOpaque so = (GinScanOpaque) scan->opaque; TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); int64 ntids; more like this: { IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0); TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); + GinScanOpaque so = (GinScanOpaque) scan->opaque; int64 ntids; I think of the PG_GETARG calls as being an ugly stepchild of a proper function header declaration, and as such, they should come first unless there is an unavoidable reason not to. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs