pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: olaf.gw@googlemail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12694: crash if the number of result rows is lower than gin_fuzzy_search_limit
Date: Fri, 30 Jan 2015 18:18:20 +0100
Message-ID: <54CBBCDC.6060009@vmware.com> (raw)
In-Reply-To: <25919.1422561570@sss.pgh.pa.us>
References: <20150128181243.2579.80775@wrigleys.postgresql.org>
	<CAB7nPqQGmwBDzX42NJPdOJ4Sgdx2PT6p8ymcTEH-+1KDiYBtCg@mail.gmail.com>
	<54CA3EB5.3030804@vmware.com>
	<4773.1422545177@sss.pgh.pa.us>
	<54CA57B9.3070602@vmware.com>
	<6517.1422547480@sss.pgh.pa.us>
	<54CA74D3.3090102@vmware.com>
	<25919.1422561570@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 01/29/2015 08:59 PM, Tom Lane wrote:
> Heikki Linnakangas <hlinnakangas@vmware.com> 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.

Nah, I'm not worried about that. ginFreeScanKeys() frees the whole 
'keys' array, so we'd have bigger problems if there was a 
reference-after-free.

> 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.

Ok, committed with that fix.

- Heikki


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (10+ messages)

Message-ID: <54CBBCDC.6060009@vmware.com>
Permalink:  ../54CBBCDC.6060009@vmware.com/
Also on:    postgresql.org/message-id/54CBBCDC.6060009@vmware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: hlinnakangas@vmware.com, tgl@sss.pgh.pa.us, michael.paquier@gmail.com, olaf.gw@googlemail.com
  Subject: Re: BUG #12694: crash if the number of result rows is lower than gin_fuzzy_search_limit
  In-Reply-To: <54CBBCDC.6060009@vmware.com>
  References: <20150128181243.2579.80775@wrigleys.postgresql.org> <CAB7nPqQGmwBDzX42NJPdOJ4Sgdx2PT6p8ymcTEH-+1KDiYBtCg@mail.gmail.com> <54CA3EB5.3030804@vmware.com> <4773.1422545177@sss.pgh.pa.us> <54CA57B9.3070602@vmware.com> <6517.1422547480@sss.pgh.pa.us> <54CA74D3.3090102@vmware.com> <25919.1422561570@sss.pgh.pa.us> <54CBBCDC.6060009@vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox