Skip to content

Commit bcc12d9

Browse files
authored
Fix heapsort in capture list construction (#748)
1 parent c987eb8 commit bcc12d9

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/pcre2_compile_cgroup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ while (TRUE)
479479
tmp = captures[i];
480480
captures[i] = captures[max];
481481
captures[max] = tmp;
482+
i = max;
482483
}
483484
}
484485

testdata/testinput2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7961,6 +7961,9 @@ a)"xI
79617961
\= Expect no match
79627962
Saturday,Sun
79637963

7964+
/()()()(?2(2,3,2,3,2))/B
7965+
abc
7966+
79647967
# Test each syntax used for recursion
79657968

79667969
/(?(R)(Sat)urday|(?R(1)),\1)/

testdata/testoutput2

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22408,6 +22408,27 @@ No match
2240822408
Saturday,Sun
2240922409
No match
2241022410

22411+
/()()()(?2(2,3,2,3,2))/B
22412+
------------------------------------------------------------------
22413+
Bra
22414+
CBra 1
22415+
Ket
22416+
CBra 2
22417+
Ket
22418+
CBra 3
22419+
Ket
22420+
Recurse
22421+
2 Capture ref
22422+
3 Capture ref
22423+
Ket
22424+
End
22425+
------------------------------------------------------------------
22426+
abc
22427+
0:
22428+
1:
22429+
2:
22430+
3:
22431+
2241122432
# Test each syntax used for recursion
2241222433

2241322434
/(?(R)(Sat)urday|(?R(1)),\1)/

0 commit comments

Comments
 (0)