Subject: Re: [PATCH v2] line-range: Fix infinite loop bug with degenerate regex

From: Junio C Hamano <[email-masked]>
Date: Wed, 07 Dec 2022 14:29:50 +0900

Ævar Arnfjörð Bjarmason <[email-masked]> writes:

> It's perfectly OK to provide a zero-width regex in general, e.g. try:
> Or for a non-git tool:
> ...

The same story goes for "^" or even ".*", I suspect.

> I think the real bug here is that we are pointing our regexec() at the
> haystack of multiple lines as an optimization.
>
> Then in "determine extent of line matched" and "is it a funcname line"
> assuming that a positive match must be non-zero-width. But that's just
> because the optimization is leaky.

Good thinking.