pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16814: Invalid memory access on regexp_match with .* and BRE
Date: Fri, 08 Jan 2021 12:19:46 -0500
Message-ID: <323716.1610126386@sss.pgh.pa.us> (raw)
In-Reply-To: <16814-6c5e3edd2bdf0d50@postgresql.org>
References: <16814-6c5e3edd2bdf0d50@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> When executing the following regexp call:
> select regexp_match('abc', '.*', 'b');
> valgrind detects an error:

Hah, nice one.  It gives the wrong answer too, at least it does most of
the time for me:

# select regexp_match('abc', '.*', 'b');
 regexp_match 
--------------
 {""}
(1 row)

That's because it's acting like the pattern is '.*?' (prefer shortest
match) rather than '.*'.

This bug is well over the age of consent, btw.  Tcl's got it too,
so it surely is aboriginal in Henry Spencer's code.

Thanks for the report!

			regards, tom lane





view thread (2+ messages)

Message-ID: <323716.1610126386@sss.pgh.pa.us>
Permalink:  ../323716.1610126386@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/323716.1610126386@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16814: Invalid memory access on regexp_match with .* and BRE
  In-Reply-To: <323716.1610126386@sss.pgh.pa.us>

* 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