Re: [pcre-dev] test

Αρχική Σελίδα
Delete this message
Συντάκτης: ph10
Ημερομηνία:  
Προς: herono2010
Υ/ο: pcre-dev
Αντικείμενο: Re: [pcre-dev] test
On Fri, 26 Oct 2018, herono2010 wrote:

> hi,
> when i use pcre lib, i have a problem like this:
>
> pattern like this:
> (?i:(?:(["'`]|(′)|(’)|(‘))\s*?(x?or|div|like|between|and)\s*?(["'`]|(′)|(’)|(‘))?\\d)|(?:\\x(?:23|27|3d))|(?:^.?(["'`]|(′)|(’)|(‘))$)|(?:(?:^(["'`\\]|(′)|(’)|(‘))*?(?:([\\d"'`]|(′)|(’)|(‘))+|([^"'`]|(′)|(’)|(‘))+(["'`]|(′)|(’)|(‘)))+\s*?(?:n?and|x?x?or|div|like|between|and|not|\|\||\&\&)\s*?([\w"'`]|(′)|(’)|(‘))[+&!@(),.-])|(?:[^\w\s]\w+\s*?[|-]\s*?(["'`]|(′)|(’)|(‘))\s*?\w)|(?:@\w+\s+(and|x?or|div|like|between|and)\s*?(["'`\\d]|(′)|(’)|(‘))+)|(?:@[\w-]+\s(and|x?or|div|like|between|and)\s*?[^\w\s])|(?:[^\w\s:]\s*?\\d\W+[^\w\s]\s*?(["'`]|(′)|(’)|(‘)).)|(?:\Winformation_schema|table_name\W)))
>
>
> source string is ten thousand 1, like this "11111111.....".
>
>
> when run in pcre_exec(), the program have a core dump, Please refer to the attachment for the program.


Please read the pcrestack man page.

Since you mention pcre_exec(), you must be using PCRE1 (the 8.xx
series), which is now obsolescent, having been succeeded by PCRE2 (the
10.xx series) in 2015.

Your pattern and subject string uses a lot of backtracking. In PCRE1,
the system stack is used. You have run out. Tests on my Linux box show
that increasing the stack from the default 8MB to 10MB make the match
succeed (giving a "no match" result).

PCRE2 has been refactored so as not to use the stack in this way. It
uses heap memory instead. This pattern and subject do not crash in
PCRE2.

Please read the pcrestack man page.

Philip

--
Philip Hazel