Re: [pcre-dev] PCRE balks at huge crazy RE

Inizio della pagina
Delete this message
Autore: ph10
Data:  
To: Jean-Christophe Deschamps
CC: pcre-dev
Oggetto: Re: [pcre-dev] PCRE balks at huge crazy RE
On Thu, 15 Aug 2013, Jean-Christophe Deschamps wrote:

>    That's it Phillip, thanks for checking. What surprises me is that it
>    reports error at pattern index 1599858, that is pattern length + 1.
>    But maybe this is an artifact in the wrapper I use for my programming
>    language.


No, it's quite normal; pcre_compile() does a dummy first pass over the
pattern in order to calculate how much memory is needed for the compiled
pattern. It then allocates the memory and does the real compile into it.
After the first pass, if the memory size is greater than the maximum, it
generates the error, so the pattern has indeed been completely scanned.
There are other cases where it detects the problem earlier in the first
pass, so this error does not always occur at the end.

Philip

--
Philip Hazel