Re: [pcre-dev] PCRE: Access Violation with studied pattern

Page principale
Supprimer ce message
Auteur: Ralf Junker
Date:  
À: pcre-dev
Sujet: Re: [pcre-dev] PCRE: Access Violation with studied pattern
On 08.06.2010 17:50, Philip Hazel wrote:

> I would if I could make it fail!
>
>> > I just found the time to test PCRE 8.10 RC 1. Unfortunately, it also
>> > shows the access violation, at the same place in pcre_exec.c, now line
>> > 5217.
> That is very odd indeed. The studying shows that, in order to match,
> there must be a whitespace character or an "x" in the input at the start
> of the match, and neither are present in your data line. Therefore,
> pcre_exec() shouldn't even start to try, and should never get anywhere
> near line 5217. I have just traced the execution on my box, and indeed
> it never tries to run the match.


Any chance you use different compile options? Here are mine:

SUPPORT_UCP=1;SUPPORT_UTF8=1;PCRE_DEBUG=1

Now with PCRE_DEBUG, I receive the outputs attached. Same pattern, two
files: One with study enabled and the other one without.

Interestingly, with study, PCRE seems to run into an endless loop:

match() returned 0 from line 2678 to line 5215
match() called in line 5215
match() returned 0 from line 2678 to line 5215
match() called in line 5215

and this goes on forever.

> So...the question is, why are you seeing something different? We should
> try to solve this problem before I release 8.10.


I am on a Windows machine (I know you never used it), but I don't think
this matters much since you could reproduce all bugs I posted previously.

If there is anything you would want me to do, please let me know.

Ralf
PCRE version 8.10-RC1 2010-06-03

/\s?xxx\s/8
------------------------------------------------------------------
\s?xxx\s
>> start branch

length=6 added 0 c=\
length=7 added 1 c=?
length=8 added 1 c=x
length=10 added 2 c=x
length=12 added 2 c=x
length=14 added 2 c=\
length=15 added 1 c=?
>> end branch

end pre-compile: length=16 workspace=7
Length = 16 top_bracket = 0 top_backref = 0
Options=00000800
Req char = x
  0  12 Bra
  3     \s?
  5     xxx
 11     \s
 12  12 Ket
 15     End
------------------------------------------------------------------
\x{E0}0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456>>>> Match against: \xc3\xa00123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456
start non-capturing bracket
bracket 0 tail recursion
match() called in line 5215
match() returned 0 from line 2678 to line 5215
match() returned 0 from line 5430 >>>> returning PCRE_ERROR_NOMATCH
No match

PCRE version 8.10-RC1 2010-06-03

/\s?xxx\s/8S
------------------------------------------------------------------
\s?xxx\s
>> start branch

length=6 added 0 c=\
length=7 added 1 c=?
length=8 added 1 c=x
length=10 added 2 c=x
length=12 added 2 c=x
length=14 added 2 c=\
length=15 added 1 c=
>> end branch

end pre-compile: length=16 workspace=7
Length = 16 top_bracket = 0 top_backref = 0
Options=00000800
Req char = x
  0  12 Bra
  3     \s?
  5     xxx
 11     \s
 12  12 Ket
 15     End
------------------------------------------------------------------
\x{E0}0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456>>>> Match against: \xa00123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456
start non-capturing bracket
bracket 0 tail recursion
match() called in line 5215
match() returned 0 from line 2678 to line 5215
match() called in line 5215
match() returned 0 from line 2678 to line 5215
match() called in line 5215
match() returned 0 from line 2678 to line 5215
match() called in line 5215

<snip>

This goes on forever (about 1 million lines truncated).

</snip>