Re: [9.2] crash on regex

From: Thom Brown <thom(at)linux(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Marko Kreen <markokr(at)gmail(dot)com>, Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [9.2] crash on regex
Date: 2012-05-24 15:29:43
Message-ID: CAA-aLv5s8y7cJUK3W1pd7UvjKjEJr+WPiEtwXpMY3zSK217-Kw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24 May 2012 16:24, Thom Brown <thom(at)linux(dot)com> wrote:
> On 24 May 2012 16:08, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Thu, May 24, 2012 at 10:16 AM, Marko Kreen <markokr(at)gmail(dot)com> wrote:
>>> Following query crashes backend on 9.2:
>>>
>>>  select substring('asd TO foo' from ' TO (([a-z0-9._]+|"([^"]+|"")+")+)');
>>
>> I spent some time trying to reduce this to the simplest case that
>> still causes a crash, and came up with this:
>>
>> select substring('a' from '((a))+');
>
> It appears to occur with any quantifier attached to a group that is
> more than 1 level deep with nothing between the groups, such as
> ((a))?, ((a))*, ((a)){1,4}, (((a)))+
>
> Or if the quantifier is the only additional thing between the groups,
> such as ((a)+)
>
> But when breaking the groups up, it's fine, so this works: ((a)b)+

Hmmm... curiously, lazy (non-greedy) quantifiers are stable, such as: ((a))*?

--
Thom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2012-05-24 15:39:13 Re: pg_stat_statments queryid
Previous Message Gurjeet Singh 2012-05-24 15:25:30 Re: Creating multiple indexes in one table scan.