Re: perl: unsafe empty pattern behavior

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: perl: unsafe empty pattern behavior
Date: 2024-03-13 04:15:18
Message-ID: 1977673.1710303318@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> On 2024-03-12 Tu 18:59, Tom Lane wrote:
>> I wonder whether perlcritic has sufficiently deep understanding of
>> Perl code that it could find these hazards.

> Yeah, that was my thought too. I'd start with ProhibitComplexRegexes.pm
> as a template.

Oooh. Taking a quick look at the source code:

https://metacpan.org/dist/Perl-Critic/source/lib/Perl/Critic/Policy/RegularExpressions/ProhibitComplexRegexes.pm

it seems like it'd be pretty trivial to convert that from "complain if
regex contains more than N characters" to "complain if regex contains
zero characters".

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Himanshu Upadhyaya 2024-03-13 04:19:04 Re: remaining sql/json patches
Previous Message Amit Kapila 2024-03-13 04:08:18 Re: Introduce XID age and inactive timeout based replication slot invalidation