Skip site navigation (1) Skip section navigation (2)

Re: to_tsquery stack overflow

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "PostgreSQL Bugs" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: to_tsquery stack overflow
Date: 2007-08-30 11:14:20
Message-ID: 46D6A68C.3030607@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-bugs
Heikki Linnakangas wrote:
> Passing a query with enough nested parenthesis in it causes a segfault.
> Attached is a handy little program to generate such a query, the actual
> query was too big to get through to the list.
> 
> The problem seems to be unbounded recursion in the makepol function that
> converts the input query from infix to polish notation. An easy fix
> would be to just add a level parameter to makepol that's incremented on
> each recursion, and throw an error if it grows bigger than some safe
> limit. There might be a similar problem in TS_execute as well, if you
> can somehow pass a complex enough TSQuery to the system, perhaps with a
> custom libpq client and tsqueryrecv.

Actually, the right way to fix that is of course to call
check_stack_depth() in makepol and TS_execute.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

In response to

Responses

pgsql-bugs by date

Next:From: Cyrus DowneyDate: 2007-08-30 13:59:32
Subject: Re: BUG #3587: EXECUTE and trigger problem [VASCL:A1226546842]
Previous:From: Heikki LinnakangasDate: 2007-08-30 10:02:24
Subject: to_tsquery stack overflow

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group