[pcre-dev] [Bug 1251] New: Fails when recursive group comes …

Top Page
Delete this message
Author: Michael
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1251] New: Fails when recursive group comes before reference
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1251
           Summary: Fails when recursive group comes before reference
           Product: PCRE
           Version: 8.12
          Platform: x86
               URL: https://bugs.php.net/bug.php?id=62041
        OS/Version: Windows
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: michael@???
                CC: pcre-dev@???



The following fails against the string '0:0:0:0::0:255.255.255.255' (without
single-quotes) when it should pass:

/^(?>([a-f0-9]{1,4})(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){6,})((?1)(?>:(?1)){0,4})?::(?>(?2):)?)(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?3)){3}$/iD

When the reference at offset 84 is switched with the grouping at offset 58 it
passes:

/^(?>([a-f0-9]{1,4})(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){6,})(?2)?::(?>((?1)(?>:(?1)){0,4}):)?)(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?3)){3}$/iD

I know that the problem is with the ':' (without single-quotes) at offset 88 of
the first example because when I replace it with another character, say an
exclamation mark (and modify the string to test to take this into account) it
passes:

/^(?>([a-f0-9]{1,4})(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){6,})((?1)(?>:(?1)){0,4})?::(?>(?2)!)?)(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?3)){3}$/iD

Testing: 0:0:0:0::0!255.255.255.255

I have tried replacing ":" with "\:" and "[:]" and it still fails.


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