Re: BUG #16814: Invalid memory access on regexp_match with .* and BRE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: exclusion(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16814: Invalid memory access on regexp_match with .* and BRE
Date: 2021-01-08 17:19:46
Message-ID: 323716.1610126386@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-01-08 20:46:07 Re: BUG #16815: Unable to use the X448 an X25519 elliptic curves.
Previous Message Jeroen Baten 2021-01-08 11:02:38 Re: BUG #16816: Unexpected escaping of html output