[pcre-dev] [Bug 1127] PCRE detects a false positive for infi…

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1127] PCRE detects a false positive for infinite recursion
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1127

Philip Hazel <ph10@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





--- Comment #1 from Philip Hazel <ph10@???> 2011-07-28 20:06:30 ---
I have committed a patch that fixes this problem. PCRE was treating
/(?(R)a+|(?R)b)/ in the same way as /a+|(?R)b/ which is, of course in danger of
looping indefinitely. The code is not clever enough to detect the safe case, so
I have done two things: (1) The compile-time test for infinite recursion no
longer happens when compiling a conditional subpattern. (2) There is now a run
time test for infinite recursion, specifically, for recursing into the same
subpattern for a second time without advancing the subject pointer. As well as
catching real cases in conditionals, this second change also catches mutual
recursions such as /((?2))((?1))/ which were not detected before (other than by
stack overflow).


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email