Re: BUG #14245: Segfault on weird to_tsquery

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: david(at)gravitext(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org, Teodor Sigaev <teodor(at)sigaev(dot)ru>
Subject: Re: BUG #14245: Segfault on weird to_tsquery
Date: 2016-07-12 19:42:25
Message-ID: 2157.1468352545@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

david(at)gravitext(dot)com writes:
> I am doing some (fuzz) testing of full text queries and managed to
> generate the following case which causes a SEGFAULT on PostgreSQL 9.6
> beta1 and beta2:
> select to_tsquery('!(a & !b) & c') as tsquery
> This weird query outputs the following on 9.5.2, instead of crashing:
> "!( !'b' ) & 'c'"

Note that while crashing is certainly not good, the pre-9.6 behavior
can hardly be called correct either. What happened to 'a'?

Also, it looks like this is specific to to_tsquery; if you just feed
the same thing to tsqueryin, it seems fine with it:

# select '!(a & !b) & c'::tsquery;
tsquery
-----------------------
!( 'a' & !'b' ) & 'c'
(1 row)

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Kellum 2016-07-12 20:54:53 Re: BUG #14245: Segfault on weird to_tsquery
Previous Message David Kellum 2016-07-12 19:04:49 Re: BUG #14245: Segfault on weird to_tsquery

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2016-07-12 20:18:19 Re: dumping database privileges broken in 9.6
Previous Message Merlin Moncure 2016-07-12 19:29:10 DO with a large amount of statements get stuck with high memory consumption