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

Startseite
Nachricht löschen
Autor: ph10
Datum:  
To: Jean-Christophe Deschamps
CC: pcre-dev
Betreff: 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