Re: BUG #16814: Invalid memory access on regexp_match with .* and BRE - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16814: Invalid memory access on regexp_match with .* and BRE
Date
Msg-id 323716.1610126386@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16814: Invalid memory access on regexp_match with .* and BRE  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
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



pgsql-bugs by date:

Previous
From: Jeroen Baten
Date:
Subject: Re: BUG #16816: Unexpected escaping of html output
Next
From: Tom Lane
Date:
Subject: Re: BUG #16815: Unable to use the X448 an X25519 elliptic curves.