[HACKERS] [9.2] crash on regex

2012-05-24 Thread Marko Kreen
Following query crashes backend on 9.2: select substring('asd TO foo' from ' TO (([a-z0-9._]+|([^]+|)+)+)'); It is supposed to load potentially quoted table name from CREATE RULE definition. Works fine on 8.3 .. 9.1 Backtrace: Program terminated with signal 11, Segmentation fault. #0

Re: [HACKERS] [9.2] crash on regex

2012-05-24 Thread Robert Haas
On Thu, May 24, 2012 at 10:16 AM, Marko Kreen mark...@gmail.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:

Re: [HACKERS] [9.2] crash on regex

2012-05-24 Thread Thom Brown
On 24 May 2012 16:08, Robert Haas robertmh...@gmail.com wrote: On Thu, May 24, 2012 at 10:16 AM, Marko Kreen mark...@gmail.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

Re: [HACKERS] [9.2] crash on regex

2012-05-24 Thread Thom Brown
On 24 May 2012 16:24, Thom Brown t...@linux.com wrote: On 24 May 2012 16:08, Robert Haas robertmh...@gmail.com wrote: On Thu, May 24, 2012 at 10:16 AM, Marko Kreen mark...@gmail.com wrote: Following query crashes backend on 9.2:  select substring('asd TO foo' from ' TO

Re: [HACKERS] [9.2] crash on regex

2012-05-24 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Thu, May 24, 2012 at 10:16 AM, Marko Kreen mark...@gmail.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

Re: [HACKERS] [9.2] crash on regex

2012-05-24 Thread Tom Lane
Thom Brown t...@linux.com writes: Hmmm... curiously, lazy (non-greedy) quantifiers are stable, such as: ((a))*? I've found it. The triggering conditions are (1) more than one set of capturing parens in a substring() pattern, and (2) at least one trial midpoint failing in ccondissect() or one of