Fix bug introduced in commit 1133. Lookbehinds that follow a condition were not

always properly handled.
This commit is contained in:
Philip.Hazel 2019-08-26 16:28:26 +00:00
parent 1e5e9aaa70
commit 45b219e6bc
5 changed files with 129 additions and 9 deletions

View File

@ -9549,13 +9549,22 @@ for (; *pptr != META_END; pptr++)
break; break;
case META_BACKREF_BYNAME: case META_BACKREF_BYNAME:
case META_RECURSE_BYNAME:
pptr += 1 + SIZEOFFSET;
break;
case META_COND_DEFINE: case META_COND_DEFINE:
case META_COND_NAME: case META_COND_NAME:
case META_COND_NUMBER: case META_COND_NUMBER:
case META_COND_RNAME: case META_COND_RNAME:
case META_COND_RNUMBER: case META_COND_RNUMBER:
case META_RECURSE_BYNAME:
pptr += 1 + SIZEOFFSET; pptr += 1 + SIZEOFFSET;
nestlevel++;
break;
case META_COND_VERSION:
pptr += 3;
nestlevel++;
break; break;
case META_CALLOUT_STRING: case META_CALLOUT_STRING:
@ -9576,7 +9585,6 @@ for (; *pptr != META_END; pptr++)
break; break;
case META_CALLOUT_NUMBER: case META_CALLOUT_NUMBER:
case META_COND_VERSION:
pptr += 3; pptr += 3;
break; break;

3
testdata/testinput1 vendored
View File

@ -6383,4 +6383,7 @@ ef) x/x,mark
/(?<=(?=(?<=a)))b/ /(?<=(?=(?<=a)))b/
ab ab
/^(?<A>a)(?(<A>)b)((?<=b).*)$/
abc
# End of testinput1 # End of testinput1

10
testdata/testinput2 vendored
View File

@ -5748,4 +5748,14 @@ a)"xI
/\A\s*((?:[^`]{28500}){4}|a)/I /\A\s*((?:[^`]{28500}){4}|a)/I
a a
/(?<A>a)(?(<A>)b)((?<=b).*)/B
/(?(1)b)((?<=b).*)/B
/(?(R1)b)((?<=b).*)/B
/(?(DEFINE)b)((?<=b).*)/B
/(?(VERSION=10.4)b)((?<=b).*)/B
# End of testinput2 # End of testinput2

View File

@ -10106,4 +10106,10 @@ No match
ab ab
0: b 0: b
/^(?<A>a)(?(<A>)b)((?<=b).*)$/
abc
0: abc
1: a
2: c
# End of testinput1 # End of testinput1

93
testdata/testoutput2 vendored
View File

@ -17294,6 +17294,99 @@ Subject length lower bound = 1
0: a 0: a
1: a 1: a
/(?<A>a)(?(<A>)b)((?<=b).*)/B
------------------------------------------------------------------
Bra
CBra 1
a
Ket
Cond
1 Cond ref
b
Ket
CBra 2
Assert back
Reverse
b
Ket
Any*+
Ket
Ket
End
------------------------------------------------------------------
/(?(1)b)((?<=b).*)/B
------------------------------------------------------------------
Bra
Cond
1 Cond ref
b
Ket
CBra 1
Assert back
Reverse
b
Ket
Any*+
Ket
Ket
End
------------------------------------------------------------------
/(?(R1)b)((?<=b).*)/B
------------------------------------------------------------------
Bra
Cond
Cond recurse 1
b
Ket
CBra 1
Assert back
Reverse
b
Ket
Any*+
Ket
Ket
End
------------------------------------------------------------------
/(?(DEFINE)b)((?<=b).*)/B
------------------------------------------------------------------
Bra
Cond
Cond false
b
Ket
CBra 1
Assert back
Reverse
b
Ket
Any*+
Ket
Ket
End
------------------------------------------------------------------
/(?(VERSION=10.4)b)((?<=b).*)/B
------------------------------------------------------------------
Bra
Cond
Cond false
b
Ket
CBra 1
Assert back
Reverse
b
Ket
Any*+
Ket
Ket
End
------------------------------------------------------------------
# End of testinput2 # End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number) Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data Error -62: bad serialized data